[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cfe-dev
Subject:    Re: [cfe-dev] [libcxx]: problem involving static const data members of class numeric_limits
From:       Howard Hinnant <hhinnant () apple ! com>
Date:       2012-11-29 15:44:44
Message-ID: B0E00B96-0BFB-420D-A1DE-A484CA9AB4D3 () apple ! com
[Download RAW message or body]


On Nov 28, 2012, at 10:30 PM, ZhangXiongpang <zhangxiongpang@gmail.com> wrote:

> 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?

Yes, this looks like a libc++ bug to me.

Howard

_______________________________________________
cfe-dev mailing list
cfe-dev@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic