re PR c++/84663 (internal compiler error: tree check: expected array_type, have error...
authorMarek Polacek <polacek@redhat.com>
Fri, 2 Mar 2018 17:54:23 +0000 (17:54 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Fri, 2 Mar 2018 17:54:23 +0000 (17:54 +0000)
PR c++/84663
* decl.c (cp_complete_array_type): Check error_mark_node.

* g++.dg/parse/array-size3.C: New test.

From-SVN: r258148

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/array-size3.C [new file with mode: 0644]

index 79e0d8f60dc38b5bc8e454ca4a345d324facd46d..29287c8d0bbbcd862a21d0175080aba61a5bdd80 100644 (file)
@@ -1,3 +1,8 @@
+2018-03-02  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/84663
+       * decl.c (cp_complete_array_type): Check error_mark_node.
+
 2018-03-02  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/84662
index 735ed5d63d25cf6df89627d7f7b890c501b91bec..1866e8f357423b07dd82c1dc03ca2ec48309e86f 100644 (file)
@@ -8323,7 +8323,7 @@ cp_complete_array_type (tree *ptype, tree initial_value, bool do_default)
      bits.  See also complete_type which does the same thing for arrays
      of fixed size.  */
   type = *ptype;
-  if (TYPE_DOMAIN (type))
+  if (type != error_mark_node && TYPE_DOMAIN (type))
     {
       elt_type = TREE_TYPE (type);
       TYPE_NEEDS_CONSTRUCTING (type) = TYPE_NEEDS_CONSTRUCTING (elt_type);
index a848cd3f2da36ac68f007f7612b1a800677c9163..42160721e0e826a241b0febe82e0362039361386 100644 (file)
@@ -3,6 +3,9 @@
        PR c++/84171
        * g++.dg/warn/Wsign-compare-8.C: New test.
 
+       PR c++/84663
+       * g++.dg/parse/array-size3.C: New test.
+
 2018-03-02  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/84662
diff --git a/gcc/testsuite/g++.dg/parse/array-size3.C b/gcc/testsuite/g++.dg/parse/array-size3.C
new file mode 100644 (file)
index 0000000..c3a824a
--- /dev/null
@@ -0,0 +1,7 @@
+// PR c++/84663
+
+struct S {
+  typedef S T[8];
+  int f : -1ULL; // { dg-warning "exceeds its type" }
+  S () { struct { T d; } e[]; } // { dg-error "size" }
+};