http://llvm.org/bugs/show_bug.cgi?id=17938
Bug ID: 17938
Summary: constexpr variable cannot initialize by nested derived
class
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
a minimal case:
^^^^
template<typename T>
constexpr T const& f(T const& x) { return x; }
struct X {};
struct Y : X {};
struct Z : Y { constexpr Z() {} }; /*user-declared constructor*/
static constexpr auto z = f(Z());
----
compile error:
^^^^
error: constexpr variable 'z' must be initialized by a constant expression
static constexpr auto z = f(Z());
^ ~~~~~~
note: subobject of type 'X' is not initialized 1 error generated.
----
http://melpon.org/wandbox/permlink/b3vxDWZB5GoWaDO5
failed in clang HEAD 3.4 (trunk 194724) -std=c++11/-std=c++1y.
I tested it in clang 3.2,3.3 and GCC 4.7,4.8 are compile succeeded.
--
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