http://llvm.org/bugs/show_bug.cgi?id=16860
Bug ID: 16860
Summary: static const member is not a constant expression when
accessed from reference with 'dot' operator and used
as a template parameter
Product: clang
Version: 3.3
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
Created attachment 11021
--> http://llvm.org/bugs/attachment.cgi?id=11021&action=edit
code generating compile error in clang but not in gcc
In c++11, it is possible to access static member variables just like regular
members with the 'dot' operator. This is of course implemented in clang.
However, the attached code does not compile with clang, and does with gcc
(4.7).
In other words: when trying to access the static member 'test::value' from 't',
which is of type 'test', everything is fine. But if one binds 't' to a
reference 'rt' (of type 'test&'), 'rt.value' is not considered a compile time
constant anymore. As an excuse, clang says that the "initializer of 'rt' is not
a constant expression".
I guess this is a bug because using 'rt.value' as the dimension of an array is
perfectly fine with both compilers.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs