C++ DR2026: static storage duration variables are not zeroed before
authorRichard Smith <richard@metafoo.co.uk>
Fri, 7 Feb 2020 00:19:37 +0000 (16:19 -0800)
committerRichard Smith <richard@metafoo.co.uk>
Fri, 7 Feb 2020 00:37:22 +0000 (16:37 -0800)
commit96c899449b61b866b583560a49c4627f561336fc
treeea3692e14e45cc4798dd3de3be8009adf04b18ce
parent3e5d837cdabca5a7f0e965fa454b169bdd45b06a
C++ DR2026: static storage duration variables are not zeroed before
constant initialization.

Removing this zeroing regressed our code generation in a few cases, also
fixed here. We now compute whether a variable has constant destruction
even if it doesn't have a constant initializer, by trying to destroy a
default-initialized value, and skip emitting a trivial default
constructor for a variable even if it has non-trivial (but perhaps
constant) destruction.
13 files changed:
clang/lib/AST/ExprConstant.cpp
clang/lib/CodeGen/CGExprConstant.cpp
clang/lib/Sema/SemaDeclCXX.cpp
clang/test/CXX/drs/dr20xx.cpp
clang/test/CXX/special/class.init/class.inhctor.init/p1.cpp
clang/test/CodeGenCXX/cxx2a-thread-local-constinit.cpp
clang/test/SemaCXX/attr-require-constant-initialization.cpp
clang/test/SemaCXX/constant-expression-cxx11.cpp
clang/test/SemaCXX/constant-expression-cxx1y.cpp
clang/test/SemaCXX/constexpr-printing.cpp
clang/test/SemaCXX/constexpr-value-init.cpp
clang/test/SemaTemplate/instantiate-self.cpp
clang/www/cxx_dr_status.html