[cfe-dev] [libcxx]: problem involving static const data members of class numeric_limits

ZhangXiongpang zhangxiongpang at gmail.com
Wed Nov 28 19:30:57 PST 2012


platform: linux, clang++3.2

testsuite:
=======================================
#include <limits>

void fun(const bool *&*) {}  // report error when the parameter type is
reference type

int main() {
    fun(std::numeric_limits<int>::is_specialized);
}
=======================================

*error: undefined reference to
`std::__1::numeric_limits<int>::is_specialized'*

N3242 9.4.2.3 says:
---------------------------------------------------
If a static data member is of const literal type, its declaration in the
class definition can specify a brace-orequal-initializer in which every
initializer-clause that is an assignment-expression is a constant
expression.
...
The member shall still be defined in a namespace scope if it is odrused
(3.2) in the program and the namespace scope definition shall not contain an
initializer.
---------------------------------------------------

I saw the static const data members (such as is_specialized, is_integer,
etc.) of class numeric_limits declared with a initializer, but not defined
out of class body. Is this libcxx's bug?

Zhang Xiongpang



--
View this message in context: http://clang-developers.42468.n3.nabble.com/libcxx-problem-involving-static-const-data-members-of-class-numeric-limits-tp4028564.html
Sent from the Clang Developers mailing list archive at Nabble.com.



More information about the cfe-dev mailing list