<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - constexpr variable cannot initialize by nested derived class"
href="http://llvm.org/bugs/show_bug.cgi?id=17938">17938</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>constexpr variable cannot initialize by nested derived class
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++11
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>bolero.murakami@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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.
----
<a href="http://melpon.org/wandbox/permlink/b3vxDWZB5GoWaDO5">http://melpon.org/wandbox/permlink/b3vxDWZB5GoWaDO5</a>
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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>