https://bugs.llvm.org/show_bug.cgi?id=43732
Richard Smith <[email protected]> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |INVALID
--- Comment #1 from Richard Smith <[email protected]> ---
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._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs