[llvm-bugs] [Bug 43921] Rejects valid: reading of an inactive union member that shares common initial sequence with the active one

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 6 10:01:31 PST 2019


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

David Blaikie <dblaikie at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID
                 CC|                            |dblaikie at gmail.com

--- Comment #1 from David Blaikie <dblaikie at gmail.com> ---
8.20 [expr.const] p2

"An expression e is a core constant expression unless the evaluation of e,
following the rules of the abstract machine (4.6), would evaluate one of the
following expressions:
...
* an lvalue-to-rvalue conversion (7.1) that is applied to a glvalue that refers
to a non-active member of a union or a subobject thereof;"

It's not undefined behavior, but it isn't allowed in a constant expression.
(the wording of the error message hints at this by saying "is not allowed in a
constant expression"

-- 
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/20191106/d9d57e4f/attachment.html>


More information about the llvm-bugs mailing list