[llvm-bugs] [Bug 43990] Incorrect error on static_assert expression

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 13 14:49:48 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=43990

Richard Smith <richard-llvm at metafoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

--- Comment #1 from Richard Smith <richard-llvm at metafoo.co.uk> ---
This is a GCC bug (though one we see filed quite a lot; the language rules seem
to not match people's intuition here).

The evaluation semantics of the expression 'x' (because it's of reference type)
involve locating the object that the reference binds to, which can't be done in
this case because we don't know the value of the function parameter 'x'. So the
evaluation of the static_assert condition is non-constant, which is invalid.

In case you're interested, this is the language rule that's violated here: 
http://eel.is/c++draft/expr.const#4.12

-- 
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/20191113/754e747c/attachment.html>


More information about the llvm-bugs mailing list