<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><span class="vcard"><a class="email" href="mailto:richard-llvm@metafoo.co.uk" title="Richard Smith <richard-llvm@metafoo.co.uk>"> <span class="fn">Richard Smith</span></a>
</span> changed
<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - static constexpr member is not a constant expression when read from a reference"
href="https://bugs.llvm.org/show_bug.cgi?id=43732">bug 43732</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>NEW
</td>
<td>RESOLVED
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>---
</td>
<td>INVALID
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - static constexpr member is not a constant expression when read from a reference"
href="https://bugs.llvm.org/show_bug.cgi?id=43732#c1">Comment # 1</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - static constexpr member is not a constant expression when read from a reference"
href="https://bugs.llvm.org/show_bug.cgi?id=43732">bug 43732</a>
from <span class="vcard"><a class="email" href="mailto:richard-llvm@metafoo.co.uk" title="Richard Smith <richard-llvm@metafoo.co.uk>"> <span class="fn">Richard Smith</span></a>
</span></b>
<pre>Clang is correct to reject this; GCC and MSVC are not precisely following the
C++ standard's rules here. The expression 'ref.value' mentions 'ref', which
implicitly reads from the reference; this is not permitted in a constant
expression because the reference does not have a constant initializer.
See:
<a href="http://eel.is/c++draft/expr.const#4.12">http://eel.is/c++draft/expr.const#4.12</a> [you can only mention 'ref' if it is
usable in constant expressions]
<a href="http://eel.is/c++draft/expr.const#3.sentence-1">http://eel.is/c++draft/expr.const#3.sentence-1</a> ['ref' is only usable in
constant expressions if it is constant-initialized]
<a href="http://eel.is/c++draft/expr.const#2.2">http://eel.is/c++draft/expr.const#2.2</a> ['ref' is only constant-initialized if
its initializer is a constant expression]
<a href="http://eel.is/c++draft/expr.const#10">http://eel.is/c++draft/expr.const#10</a> [the initializer is only a constant
expression if 'a' is a permitted result of a constant evaluation]
<a href="http://eel.is/c++draft/expr.const#10.sentence-2">http://eel.is/c++draft/expr.const#10.sentence-2</a> ['a' is not a permitted result
of a constant evaluation because it does not have static storage duration]</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>