[LLVMbugs] [Bug 17938] New: constexpr variable cannot initialize by nested derived class
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Nov 15 03:40:17 PST 2013
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: unassignedclangbugs at nondot.org
Reporter: bolero.murakami at gmail.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20131115/52f8fe25/attachment.html>
More information about the llvm-bugs
mailing list