[Bug c++/60225] [4.9 Regression] [c++11] ICE initializing constexpr array

paolo.carlini at oracle dot com gcc-bugzilla@gcc.gnu.org
Mon Feb 17 17:36:00 GMT 2014


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60225

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Thus, it seems to me that to have a consistent literal_type_p /
ensure_literal_type_for_constexpr_object pair we should use strip_array_types
in the latter too. The below passes testing, for example:

Index: semantics.c
===================================================================
--- semantics.c    (revision 207817)
+++ semantics.c    (working copy)
@@ -7380,7 +7380,8 @@ ensure_literal_type_for_constexpr_object (tree dec
   if (VAR_P (decl) && DECL_DECLARED_CONSTEXPR_P (decl)
       && !processing_template_decl)
     {
-      if (CLASS_TYPE_P (type) && !COMPLETE_TYPE_P (complete_type (type)))
+      tree stype = strip_array_types (type);
+      if (CLASS_TYPE_P (stype) && !COMPLETE_TYPE_P (complete_type (stype)))
     /* Don't complain here, we'll complain about incompleteness
        when we try to initialize the variable.  */;
       else if (!literal_type_p (type))



More information about the Gcc-bugs mailing list