You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue description: P0593R6 made pseudo-destructor calls end lifetime of scalar objects. However, currently there lacks wording indicating that destroying an already destroyed scalar object is undefined behavior, which is inconsistent with class objects.
Currently, implementations tend to accept such double destruction in constant evaluation (Godbolt link). Note that Clang is inconsistent with itself, which seems to be a bug.
using I = int;
constexpr I x = (I{}.~I(), 0); // clang, gcc, and msvc accept thisconstexpr I y = ((0).~I(), 0); // clang only rejects this
On the other hand, it is arguably better to keep and clarify the status quo, which avoids inceasing UB.
Suggested resolution:
The changes in cplusplus/draft#4953, if it is intented to make such double destruction undefined.