groundswellaudio wrote: Thanks for the fix @cor3ntin. There is still a problem however with `std::optional`, which I think boils down to implicit destructor and anonymous union :
```cpp struct A { A (); ~A(); }; template <class T> struct opt { union { char c; T data; }; constexpr opt() {} constexpr ~opt() { if (engaged) data.~T(); } bool engaged = false; }; consteval void foo() { opt<A> a; } ``` This fails with `non-literal type 'opt<A>' cannot be used in a constant expression`, but compiles if A has no destructor (or if that destructor is constexpr). I suspect that the culprit is here : https://github.com/llvm/llvm-project/blob/fca6992be1f272f5e997bd510ca03c9389550c13/clang/lib/AST/DeclCXX.cpp#L550 The implicit destructor of the anonymous union is not constexpr because one of its subobjects has a non-constexpr destructor. https://github.com/llvm/llvm-project/pull/78195 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits