Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-07-07 12:40:08


"Robert Ramey" <ramey_at_[hidden]> writes:

> I have the following little test program
>
> #include <boost/static_assert.hpp>
> #include <boost/type_traits/is_polymorphic.hpp>
>
> struct vbase
> {
> };
>
> struct derived : public virtual vbase
> {
> };
>
> // VC 7.1, borland 5.51 and Commeau trap here (gcc 3.2 doesn't trap here!)
> BOOST_STATIC_ASSERT(boost::is_polymorphic<derived>::value);

I think this is a problem and I doubt we can implement an
is_polymorphic that does the right thing on gcc for this case.

> // everything including gcc traps here !
> BOOST_STATIC_ASSERT(boost::is_polymorphic<vbase>::value);

One would expect it to. vbase is not polymorphic!

> int main(int argc, char *argv[])
> {
> }
>
> This suggests to me that is_polymorphic returns true for a class
> derived virtually from a base class under the gcc compiler even
> though the base class has no virtual function!

Seems so.

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk