>From: "John Maddock" <[EMAIL PROTECTED]> > >This is tested on Comeau 4.3, Intel C++ 6/7 and g++ 3.2. > > Except it *doesn't work* ! > > The problem is that your static assertion don't test anything, changing to: > > //typedef char TestA[is_base_and_derived<B, D>::result]; // Multiple bases > (error on g++) > typedef char TestB[is_base_and_derived<B1,D>::result ? 1 : -1]; > //typedef char TestC[is_base_and_derived<B2,D>::result]; // Private base > (error on g++) > typedef char TestD[!is_base_and_derived<int,D>::result ? 1 : -1]; > typedef char TestE[!is_base_and_derived<B, B>::result ? 1 : -1]; > typedef char TestF[is_base_and_derived<B,DV>::result ? 1 : -1]; // Virtual > base > > and both Borland and gcc 3.21 give errors on cases 2 and 6
Well, this means that there are other problems in these compilers. The following _should_ give an error: typedef char Test[0]; and indeed it does on the EDG compilers. Well, then it turns out that even this version doesn't work correctly on g++ and Borland, and it doesn't give an error, either, for the above cases. Using BOOST_STATIC_ASSERT, this would have been detected. There's no need to shout. :) The test code should work on a conforming compiler. By the way, those "static asserts" were "inherited" from Rani's example code, with a couple of additions. I guess this is a good reason to use a portable static assert, like the Boost one. Regards, Terje _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost