Boost logo

Boost :

Subject: Re: [boost] [type_traits] is_base_of<> GCC error for v1.42.0
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2010-05-15 20:06:48


----- Original Message -----
From: "Lorenzo Caminiti" <lorcaminiti_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Saturday, May 08, 2010 10:38 PM
Subject: [boost] [type_traits] is_base_of<> GCC error for v1.42.0

Hello all,

The following code gives the GCC compiler error below for Boost 1.42.0
while it compiles just fine for Boost 1.34.1.

Is this a bug in Boost.TypeTraits for 1.42.0?

    // File: b00.cpp
    #include <boost/type_traits.hpp>
    #include <iostream>

    struct y {};

    struct x: y {
        static const bool v = boost::is_base_of<y, x>::value;
    };

_______________________________________________
Hi,
As John stated this is the expected behavior.

If you need it, you can define the constant once the classes are completly declared.

    struct y {};

    struct x: y {
        static const bool v;
    };

    const bool x::v = boost::is_base_of<y, x>::value;

HTH,
Vicente


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