From 85cda0604e317de7680f8235df7b9c7ffd741199 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Wed, 21 May 2003 11:17:09 +0000 Subject: [PATCH] Added bug fix for case that a polymorphic class has a member named "foo". [SVN r18481] --- include/boost/type_traits/is_polymorphic.hpp | 3 ++- test/is_polymorphic_test.cpp | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/boost/type_traits/is_polymorphic.hpp b/include/boost/type_traits/is_polymorphic.hpp index c9bb14d..9612284 100644 --- a/include/boost/type_traits/is_polymorphic.hpp +++ b/include/boost/type_traits/is_polymorphic.hpp @@ -36,7 +36,8 @@ struct is_polymorphic_imp1 virtual ~d2()throw(); # ifndef BOOST_MSVC // for some reason this messes up VC++ when T has virtual bases: - virtual void foo(); + struct unique{}; + virtual void foo(unique*); # endif char padding[256]; }; diff --git a/test/is_polymorphic_test.cpp b/test/is_polymorphic_test.cpp index 50eba2e..da1abe3 100644 --- a/test/is_polymorphic_test.cpp +++ b/test/is_polymorphic_test.cpp @@ -15,6 +15,9 @@ #include // more things to test #endif +// this test was added to check for bug reported on 21 May 2003: +struct poly_bug { virtual int foo() = 0; }; + TT_TEST_BEGIN(is_polymorphic) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_polymorphic::value, false); @@ -64,6 +67,10 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_polymorphic::value, true BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_polymorphic::value, true); #endif +// +// this test was added to check for bug reported on 21 May 2003: +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_polymorphic::value, true); + TT_TEST_END