re PR c++/28347 (ICE on typedef with initialization)
authorLee Millward <lee.millward@codesourcery.com>
Fri, 4 Aug 2006 18:08:14 +0000 (18:08 +0000)
committerLee Millward <lmillward@gcc.gnu.org>
Fri, 4 Aug 2006 18:08:14 +0000 (18:08 +0000)
        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

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/typedef-init.C

index 47513ef9018d8b4dc0db99d18e10b43925225c1a..1f05b730aa82e549f3d1145d0c2b1aa1ce899791 100644 (file)
@@ -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
index 0e2a87e4acdf5a298eb092e4895852a7aa33685b..b03ea62a2ede5b02d59dcc7efe8a3e1d45bce55e 100644 (file)
@@ -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);
index a07f7c1c4a0aa26875c9ebf2b348c123c70951ff..9f0818209b0bec0f7d35af9cacd02a38a13f5396 100644 (file)
@@ -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
index 1b2a05db63c810826bbd5f75000b2106309cb9ac..95a96d551621200d6d50f9cc6b92aed7432a35db 100644 (file)
 
 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" } */
+}