
I have a piece of code which boils down to: ====================================== #include <boost/type_traits/is_base_and_derived.hpp> #include <boost/static_assert.hpp> struct Base { }; template< typename T > struct A { BOOST_STATIC_ASSERT(( boost::is_base_and_derived< Base, T
::value )); struct Inner { }; };
struct Derived : Base { typedef A< Derived >::Inner Inner; }; ======================================= This had been compiling fine with gcc 3.3 up to 4.1.1, but the assertion fails on the current 4.1.2 snapshot as a result of the fix for PR 27177 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27177) because Derived is incomplete -- although its base class is already known. The failure basically comes down to code like this: ======================================= struct Z {}; struct A : Z {}; Z* implicitToZ (Z*); struct B : A { static const int i = sizeof(implicitToZ((B*)0)); }; ======================================== This compiles up to gcc 4.1.1, and also with Comeau (try pasting it into http://www.comeaucomputing.com/tryitout/), but not with the gcc 4.1.2 snapshot.
From discussion on the above bug page, it appears unclear whether this or not this code is actually legal... has the patch broken something which should be expected to work, or are the existing versions of gcc and Comeau accepting illegal code?
Zak.