[llvm-bugs] [Bug 43732] static constexpr member is not a constant expression when read from a reference
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Oct 20 17:28:38 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=43732
Richard Smith <richard-llvm at metafoo.co.uk> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |INVALID
--- Comment #1 from Richard Smith <richard-llvm at metafoo.co.uk> ---
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:
http://eel.is/c++draft/expr.const#4.12 [you can only mention 'ref' if it is
usable in constant expressions]
http://eel.is/c++draft/expr.const#3.sentence-1 ['ref' is only usable in
constant expressions if it is constant-initialized]
http://eel.is/c++draft/expr.const#2.2 ['ref' is only constant-initialized if
its initializer is a constant expression]
http://eel.is/c++draft/expr.const#10 [the initializer is only a constant
expression if 'a' is a permitted result of a constant evaluation]
http://eel.is/c++draft/expr.const#10.sentence-2 ['a' is not a permitted result
of a constant evaluation because it does not have static storage duration]
--
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/20191021/8a4b5e48/attachment.html>
More information about the llvm-bugs
mailing list