[Bug c++/125569] GCC treats a class with a deleted destructor as std::is_literal_type
qurong at ios dot ac.cn
gcc-bugzilla@gcc.gnu.org
Fri Jun 5 07:55:53 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125569
--- Comment #4 from qurong at ios dot ac.cn ---
Look at the second test case in https://godbolt.org/z/1ssacrEcx.
In C++20, the following should be ill-formed:
struct NotLiteralCpp20 {
~NotLiteralCpp20() = delete;
};
template <NotLiteralCpp20 x> // should be ill-formed
struct Foo {};
Although std::is_literal_type was removed, a class with a deleted
(non-constexpr) destructor is not a literal type in C++20, so it cannot be used
as a non-type template parameter. Clang rejects this, but GCC currently accepts
it.
More information about the Gcc-bugs
mailing list