aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2002-10-31 00:04:12 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2002-10-31 00:04:12 +0000
commit8c081e84f7b8dbc477c62c5a16834e2f6ce9d095 (patch)
tree74cb4f2dd20fa6d242447fa4a4194d8b4f40e4fb
parent9402f6fb7450c77691ef079abae90b2130a65117 (diff)
downloadgcc-8c081e84f7b8dbc477c62c5a16834e2f6ce9d095.zip
gcc-8c081e84f7b8dbc477c62c5a16834e2f6ce9d095.tar.gz
gcc-8c081e84f7b8dbc477c62c5a16834e2f6ce9d095.tar.bz2
re PR c++/8160 (ICE in build_modify_expr, at cp/typeck.c:5494: Array initialization)
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. PR c++/8160 * g++.dg/template/complit1.C: New test. PR c++/8149 * g++.dg/template/typename4.C: Likewise. From-SVN: r58663
-rw-r--r--gcc/cp/ChangeLog8
-rw-r--r--gcc/cp/decl.c7
-rw-r--r--gcc/cp/typeck2.c2
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/g++.dg/template/complit1.C11
-rw-r--r--gcc/testsuite/g++.dg/template/typename4.C3
6 files changed, 39 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 1dc2487..d53fd4d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 4fcb363..9ee0556 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -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
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index b8d0869..750aa3c 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -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;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2c0826d..437893d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..ab057b3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/complit1.C
@@ -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
index 0000000..add9515
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/typename4.C
@@ -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 "" }