Clang either crashes or choose wrong destructor when using multiple destructors using C++20 constraints #49914
Labels
bugzilla
Issues migrated from bugzilla
c++20
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
concepts
C++20 concepts
duplicate
Resolved as duplicate
Extended Description
Overview: When we use multiple destructor (1 default and 1 constraint 1) , using just a simple constraint, then 1 of 2 things happen:
A.) If we define the constraint destructor first, and then define default destructor:
https://godbolt.org/z/PWbfzscs4
Actual result: the compiler crashed (you can see the error through the cooler l compiler explorer (godbolt)).
Expected result: the clang should choose the constraint destructor on ob1 (hasRelease) and default destructor on ob2. The GCC produce the expected output
The program works on GCC and didn't work on clang, where we declared the constraint destructor first and then default destructor (GCC compiler & executor on the upper window and Clang on the lower)
https://godbolt.org/z/PWbfzscs4
You can check on godbolt through the above link
B.) When we declared the default destructor first, & then the constraint destructor
https://godbolt.org/z/ss11d5cdd
When we declared the default destructor first, & then the constraint destructor , the Clang compiles, but the default destructor is called & the constraint destructor is discarded every time(see the executor and assembly in clang).
Whereas, GCC executes correctly.
The text was updated successfully, but these errors were encountered: