Boost logo

Boost :

From: Jaap Suter (J.Suter_at_[hidden])
Date: 2003-01-01 18:44:12


Hi,

Compiling the following code on Borland 5.6:

_________________________________

template < size_t N > struct widget {};

template < class T >
struct foo
{
    BOOST_STATIC_CONSTANT( size_t, static_constant = 42 );
    typedef widget< static_constant > bar_1;
    size_t bar_2() { return static_constant; }
};
_________________________________

Gives the following three errors on the line that defines bar_1:

Member foo<T>::static_constant cannot be used without an object
Invalid template argument list
Declaration terminated incorrectly

The bar_2 member function compiles fine.
Also, if I make foo a non-template class, everything compiles fine.

This compiler does not result in the definition of
BOOST_NO_INCLASS_MEMBER_INITIALIZATION so the enum-hack isn't used. However,
if I do in fact use the enum-hack the above code compiles fine too.

Am I missing something here, or maybe Borlands static-class-constants
behaviour is not 100% perfect....

Thanks,

Jaap Suter


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