]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/8160 (ICE in build_modify_expr, at cp/typeck.c:5494: Array initialization)
authorMark Mitchell <mark@codesourcery.com>
Thu, 31 Oct 2002 00:02:35 +0000 (00:02 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Thu, 31 Oct 2002 00:02:35 +0000 (00:02 +0000)
PR c++/8160
* g++.dg/template/complit1.C: New test.

PR c++/8149
* g++.dg/template/typename4.C: Likewise.

PR c++/8160
* typeck2.c (process_init_constructor): Call complete_array_type.

PR c++/8149
* decl.c (make_typename_type): Issue errors about invalid results.

From-SVN: r58662

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/typeck2.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/complit1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/template/typename4.C [new file with mode: 0644]

index dd372fbee1bb8eb57b0cbe997b68f8b1690fa210..aa6923a16832182e5847028406673193851bafc7 100644 (file)
@@ -1,3 +1,11 @@
+2002-10-30  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/8160
+       * typeck2.c (process_init_constructor): Call complete_array_type.
+
+       PR c++/8149
+       * decl.c (make_typename_type): Issue errors about invalid results.
+       
 2002-10-29  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/8287
index 613766253f3be926af91fe2a97d72326908ad616..06b081c2831dff13e8ca9a994c3c21a5a70c882a 100644 (file)
@@ -5759,6 +5759,12 @@ make_typename_type (context, name, complain)
          t = lookup_field (context, name, 0, 1);
          if (t)
            {
+             if (TREE_CODE (t) != TYPE_DECL)
+               {
+                 if (complain & tf_error)
+                   error ("no type named `%#T' in `%#T'", name, context);
+                 return error_mark_node;
+               }
              if (DECL_ARTIFICIAL (t) || !(complain & tf_keep_type_decl))
                t = TREE_TYPE (t);
              if (IMPLICIT_TYPENAME_P (t))
index 3f7a004d3b57281ca1851fe3d4c3ae234a707a59..f8e612bf6a877e0339d16534dd97e7d3bdb5cf13 100644 (file)
@@ -975,6 +975,8 @@ process_init_constructor (type, init, elts)
     return error_mark_node;
 
   result = build (CONSTRUCTOR, type, NULL_TREE, nreverse (members));
+  if (TREE_CODE (type) == ARRAY_TYPE && TYPE_DOMAIN (type) == NULL_TREE)
+    complete_array_type (type, result, /*do_default=*/0);
   if (init)
     TREE_HAS_CONSTRUCTOR (result) = TREE_HAS_CONSTRUCTOR (init);
   if (allconstant) TREE_CONSTANT (result) = 1;
index 4b1531d85f70da858ce138166691aaab4043cf12..22fecac0d347d7bf023a9619f136334125b602a6 100644 (file)
@@ -1,3 +1,11 @@
+2002-10-30  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/8160
+       * g++.dg/template/complit1.C: New test.
+
+       PR c++/8149
+       * g++.dg/template/typename4.C: Likewise.
+
 2002-10-29  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/8287
diff --git a/gcc/testsuite/g++.dg/template/complit1.C b/gcc/testsuite/g++.dg/template/complit1.C
new file mode 100644 (file)
index 0000000..ab057b3
--- /dev/null
@@ -0,0 +1,11 @@
+// { dg-options "" }
+
+template <int D> struct C {
+  int d[3];
+  C();
+};
+
+template<int D>
+C<D>::C() : d((int[]){1,2,3}) {};
+
+template class C<1>;
diff --git a/gcc/testsuite/g++.dg/template/typename4.C b/gcc/testsuite/g++.dg/template/typename4.C
new file mode 100644 (file)
index 0000000..add9515
--- /dev/null
@@ -0,0 +1,3 @@
+struct B { template <typename U> struct C; };
+template <typename T> struct A { typedef typename T::C V; }; // { dg-error "" }
+void f () { A<B>::V p; } // { dg-error "" }