https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114426
--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Actually I had another look. Jason said in the c++: fix in-charge parm in constexpr mail back in December (as well as in the r14-6507 commit message): "Since a class with vbases can't have constexpr 'tors there isn't actually a need for an in-charge parameter in a destructor" but the ICE is because the destructor is marked implicitly constexpr. https://eel.is/c++draft/dcl.constexpr#3.2 says that a destructor of a class with virtual bases is not constexpr-suitable, but we were actually implementing this just for constructors, so clearly my fault from the https://wg21.link/P0784R7 implementation. That paper clearly added that sentence in there and removed similar sentence just from the constructor case. --- gcc/cp/constexpr.cc.jj 2024-04-09 09:29:04.708521907 +0200 +++ gcc/cp/constexpr.cc 2024-04-12 11:45:08.845476718 +0200 @@ -262,18 +262,15 @@ is_valid_constexpr_fn (tree fun, bool co inform (DECL_SOURCE_LOCATION (fun), "lambdas are implicitly %<constexpr%> only in C++17 and later"); } - else if (DECL_DESTRUCTOR_P (fun)) + else if (DECL_DESTRUCTOR_P (fun) && cxx_dialect < cxx20) { - if (cxx_dialect < cxx20) - { - ret = false; - if (complain) - error_at (DECL_SOURCE_LOCATION (fun), - "%<constexpr%> destructors only available" - " with %<-std=c++20%> or %<-std=gnu++20%>"); - } + ret = false; + if (complain) + error_at (DECL_SOURCE_LOCATION (fun), + "%<constexpr%> destructors only available with " + "%<-std=c++20%> or %<-std=gnu++20%>"); } - else if (!DECL_CONSTRUCTOR_P (fun)) + else if (!DECL_CONSTRUCTOR_P (fun) && !DECL_DESTRUCTOR_P (fun)) { tree rettype = TREE_TYPE (TREE_TYPE (fun)); if (!literal_type_p (rettype)) patch fixes the ICE too, just will need to add testcase coverage and see what regresses in the testsuite...