[LLVMbugs] [Bug 16860] New: static const member is not a constant expression when accessed from reference with 'dot' operator and used as a template parameter
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sun Aug 11 14:42:13 PDT 2013
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: unassignedclangbugs at nondot.org
Reporter: darkdragon1 at free.fr
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130811/d3a45117/attachment.html>
More information about the llvm-bugs
mailing list