<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - Constant expression from permitted result of a constant expression is not constexpr"
href="https://bugs.llvm.org/show_bug.cgi?id=34253">34253</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Constant expression from permitted result of a constant expression is not constexpr
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>antoshkka@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>The following code fails to compile:
int main() {
static const char someVar[] = "str";
constexpr auto c0 = someVar[0];
}
error: constexpr variable 'c0' must be initialized by a constant expression
constexpr auto c0 = someVar[0];
^ ~~~~~~~~~~
This seems to be an error:
"In any constexpr variable declaration, the full-expression of the
initialization shall be a constant expression [expr.const]"
Where [expr.const] has the paragraphs:
"A constant expression is either a glvalue core constant expression that refers
to an entity that is a permitted result of a constant expression <skip>
An entity is a permitted result of a constant expression if it is an object
with static storage duration that is either not a temporary object <skip>"</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>