Closed Quuxplusone closed 5 years ago
Bugzilla Link | PR43280 |
Status | RESOLVED FIXED |
Importance | P normal |
Reported by | Tom Hender (ToHe_EMA@gmx.de) |
Reported on | 2019-09-11 09:44:19 -0700 |
Last modified on | 2019-09-11 15:37:20 -0700 |
Version | trunk |
Hardware | PC All |
CC | blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk, rnk@google.com |
Fixed by commit(s) | |
Attachments | |
Blocks | |
Blocked by | |
See also |
Formally, this code is invalid: prior to C++17, static data members whose
addresses are used are required to be defined outside the class. You are
missing such a definition, which would look like this:
const char *const Struct::ConstexprVar;
(Or you can use -std=c++17 to enable C++17 mode, in which this code is valid
without an out-of-line definition.)
That said... it's my understanding that the MS C++ ABI expects a definition for
Struct::ConstexprVar to be implicitly synthesized in every compilation that
uses it, rather than requiring an out-of-line definition. It looks like we only
do this for variables of integral or enumeration type currently, which I think
is a bug.
Coincidentally, I think https://reviews.llvm.org/D47956 will fix this by making these constexpr things inline even in pre C++17 modes. See issue 36125 as a potential dupe.
r371642