https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58969
Kai Tietz <ktietz at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu.org, | |ktietz at gcc dot gnu.org --- Comment #1 from Kai Tietz <ktietz at gcc dot gnu.org> --- Hmm, issue seems to be in too restrictive decl_maybe_constant_var_p function. We could allow here additional ARRAY_TYPEs with constant, non-vla, and trivial destructors. Maybe even non-trivial destructors could be ok. Not sure Suggested patch, which allows provided testcase to run is: Index: decl2.c =================================================================== --- decl2.c (Revision 218570) +++ decl2.c (Arbeitskopie) @@ -4157,8 +4157,12 @@ decl_maybe_constant_var_p (tree decl) return false; if (DECL_DECLARED_CONSTEXPR_P (decl)) return true; - return (CP_TYPE_CONST_NON_VOLATILE_P (type) - && INTEGRAL_OR_ENUMERATION_TYPE_P (type)); + if (!CP_TYPE_CONST_NON_VOLATILE_P (type)) + return false; + return ((TREE_CODE (type) == ARRAY_TYPE + && !TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (type)) + && !array_of_runtime_bound_p (type)) + || INTEGRAL_OR_ENUMERATION_TYPE_P (type)); } /* Complain that DECL uses a type with no linkage. In C++98 mode this is