efriedma added inline comments.
================ Comment at: clang/test/CodeGenCXX/static-init.cpp:181 +#if __cplusplus >= 202002L +// A const object with constexpr destructor can be emitted as a constant. +namespace test5 { ---------------- I don't see how this works. For a static local variable, in general, we register the destructor with __cxa_atexit, and the destructor can have arbitrary side-effects. For example: ``` extern void foo(); struct A { constexpr A() : x(1) {} constexpr ~A() {if (x) foo();} int x; }; const int *f() { static const A a{}; return &a.x; } ``` CHANGES SINCE LAST ACTION https://reviews.llvm.org/D145369/new/ https://reviews.llvm.org/D145369 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits