https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116206
Bug ID: 116206
Summary: No failure when all C++20 prospective destructors are
not viable when templated class definition is
instantiated
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mital at mitalashok dot co.uk
Target Milestone: ---
https://godbolt.org/z/f7bcazeo9
template<typename T>
struct X {
~X() requires(sizeof(T) == 2);
};
void adl(X<char>*);
int main() {
sizeof(X<char>);
adl((X<char>*) nullptr);
}
Either of the two lines in `main` should cause an error, but GCC accepts this.
https://eel.is/c++draft/class.dtor#4
> At the end of the definition of a class, overload resolution
> is performed among the prospective destructors declared in
> that class with an empty argument list to select the
> *destructor* for the class, also known as the
> *selected destructor*. The program is ill-formed if overload
> resolution fails.