aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLee Millward <lee.millward@codesourcery.com>2006-08-04 18:08:14 +0000
committerLee Millward <lmillward@gcc.gnu.org>2006-08-04 18:08:14 +0000
commitcc011e7f12afb47a0487e9645bc125681b8b136f (patch)
tree51f9d2b4792206f7607a2ca78c7e19e23588e329
parent71156bccaa2aadde4cc420bb719626c59380561b (diff)
downloadgcc-cc011e7f12afb47a0487e9645bc125681b8b136f.zip
gcc-cc011e7f12afb47a0487e9645bc125681b8b136f.tar.gz
gcc-cc011e7f12afb47a0487e9645bc125681b8b136f.tar.bz2
re PR c++/28347 (ICE on typedef with initialization)
PR c++/28347 * decl.c (start_decl): Return error_mark_node if a diagnostic was issed for an invalid typedef initialization. * g++.dg/ext/typedef-init.C: Add new test for typedef initialization inside templates. Adjust existing error markers From-SVN: r115931
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c3
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/g++.dg/ext/typedef-init.C9
4 files changed, 21 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 47513ef..1f05b73 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2006-08-03 Lee Millward <lee.millward@codesourcery.com>
+
+ PR c++/28347
+ * decl.c (start_decl): Return error_mark_node if a
+ diagnostic was issed for an invalid typedef initialization.
+
2006-08-03 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/27508
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 0e2a87e..b03ea62 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -3860,8 +3860,7 @@ start_decl (const cp_declarator *declarator,
{
case TYPE_DECL:
error ("typedef %qD is initialized (use __typeof__ instead)", decl);
- initialized = 0;
- break;
+ return error_mark_node;
case FUNCTION_DECL:
error ("function %q#D is initialized like a variable", decl);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a07f7c1..9f08182 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2006-08-03 Lee Millward <lee.millward@codesourcery.com>
+
+ PR c++/28347
+ * g++.dg/ext/typedef-init.C: Add new test for typedef
+ initialization inside templates. Adjust existing
+ error markers.
+
2006-08-03 Mark Mitchell <mark@codesourcery.com>
PR c++/28148
diff --git a/gcc/testsuite/g++.dg/ext/typedef-init.C b/gcc/testsuite/g++.dg/ext/typedef-init.C
index 1b2a05d..95a96d5 100644
--- a/gcc/testsuite/g++.dg/ext/typedef-init.C
+++ b/gcc/testsuite/g++.dg/ext/typedef-init.C
@@ -13,12 +13,12 @@
typedef A = 0; /* { dg-error "initialized" "A" } */
/* { dg-warning "no type" "A warns" { target *-*-* } 14 } */
-A a; /* { dg-bogus "" "A error cascade" } */
+A a; /* { dg-error "does not name a type" "A error cascade" } */
/* Case B: with a type also. */
typedef int B = 0; /* { dg-error "initialized" "B" } */
-B b; /* { dg-bogus "" "B error cascade" } */
+B b; /* { dg-error "does not name a type" "B error cascade" } */
/* C and D are the same as A and B, but wrapped in a structure;
field declarations go by a different code path in C++ (ick). */
@@ -31,3 +31,8 @@ struct S {
typedef int D = 0; /* { dg-error "initialized" "D" } */
D d; /* { dg-bogus "" "D error cascade" } */
};
+
+template<int> void foo()
+{
+ typedef int i = 0; /* { dg-error "is initialized" } */
+}