Boost logo

Boost :

From: Alexander Nasonov (alnsn-boost_at_[hidden])
Date: 2005-05-30 09:17:31


BOOST_TYPEOF( Z() ), where Z is a class type, gives different results in native
and compliant modes, at least on gcc 3.2.2.

#include <boost/typeof/typeof.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/type_traits/is_same.hpp>

#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()

struct Z {};

BOOST_TYPEOF_REGISTER_TYPE(Z)

int main()
{
    typedef Z(F)(); // function in native mode
    typedef BOOST_TYPEOF( Z() ) fn_or_class;

    // Which line should be commeneted?
    BOOST_MPL_ASSERT(( boost::is_same<fn_or_class,Z> ));
    BOOST_MPL_ASSERT(( boost::is_same<fn_or_class,F> ));
}

--
Alexander Nasonov

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