[llvm-bugs] [Bug 48585] Clang incorrectly discards constructor of global variable

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Dec 23 17:32:12 PST 2020


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

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

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

--- Comment #3 from Richard Smith <richard-llvm at metafoo.co.uk> ---
This behavior is correct, and required by the standard. See [expr.const]/14:

"An expression or conversion is manifestly constant-evaluated if it is [...]
the initializer of a variable that [...] has constant initialization"

'globalVariable' has constant initialization, so is_constant_evaluated()
returns true during its initialization.

MSVC has a very long-standing bug where it fails to properly implement constant
initialization for global variables; that's probably why you're seeing a
behavior difference between the two compilers here.

-- 
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/20201224/1c3e136c/attachment.html>


More information about the llvm-bugs mailing list