From: Jens Maurer (Jens.Maurer_at_[hidden])
Date: 2001-04-30 16:20:03
John Maddock wrote:
> >Thus, for the above example to work, you need to add
> >#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
> >template<class T>
> >const bool X<T>::value;
> >to your source code.
> I thought you only needed that if the value was used in a way that causes
> it's address to be taken (issue 48).
Indeed, but "taking the address" isn't meant in the specific sense
of applying operator& to it.
Here's the new wording from the proposed resolution for core issue 48:
>>> An expression is potentially evaluated unless it appears where an
>>> integral constant expression is required (see 5.19 expr.const ),
>>> is the operand of the sizeof operator (5.3.3 expr.sizeof ), or is
>>> the operand of the typeid operator and the expression does not
>>> designate an lvalue of polymorphic class type (5.2.8 expr.typeid ).
Further on, in the existing standard text, it says
>>> An object or non-overloaded function is used if its name appears
>>> in a potentially-evaluated expression.
I would take this to mean that code like
char m = integer_traits<char>::min_val;
"uses" the object min_val and thus requires a definition for it.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk