Fix interaction of `constinit` and `weak`.
authorRichard Smith <richard@metafoo.co.uk>
Wed, 30 Sep 2020 17:48:00 +0000 (10:48 -0700)
committerRichard Smith <richard@metafoo.co.uk>
Wed, 30 Sep 2020 17:49:50 +0000 (10:49 -0700)
commit892df30a7f344b6cb9995710efbc94bb25cfb95b
tree24ecb777170f2fcb5742f8f05dd4369132407496
parent700e63293eea4a23440f300b1e9125ca2e80c6e9
Fix interaction of `constinit` and `weak`.

We previously took a shortcut and said that weak variables never have
constant initializers (because those initializers are never correct to
use outside the variable). We now say that weak variables can have
constant initializers, but are never usable in constant expressions.
clang/lib/AST/Decl.cpp
clang/lib/AST/ExprConstant.cpp
clang/lib/Sema/SemaDeclCXX.cpp
clang/test/SemaCXX/cxx20-constinit.cpp [new file with mode: 0644]