PR c++/8160
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 31 Oct 2002 00:04:12 +0000 (00:04 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 31 Oct 2002 00:04:12 +0000 (00:04 +0000)
* typeck2.c (process_init_constructor): Call complete_array_type.

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

PR c++/8160
* g++.dg/template/complit1.C: New test.

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@58663 138bc75d-0d04-0410-961f-82ee72b054a4

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 1dc2487..d53fd4d 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-30  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
 
        Core issue 287, PR c++/7639
index 4fcb363..9ee0556 100644 (file)
@@ -5702,6 +5702,13 @@ 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 (complain & tf_parsing)
                type_access_control (context, t);
              else
index b8d0869..750aa3c 100644 (file)
@@ -942,6 +942,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 2c0826d..437893d 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-30  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
 
        Core issue 287, PR c++/7639
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 "" }