re PR c++/28303 (ICE on invalid typedef)

PR c++/28303
        * decl.c (grokdeclarator): Return error_mark_node on
        declaration with two or more data types.

        * g++.dg/template/typedef6.C: New test.
        * g++.dg/init/error1.C: Adjust error markers.
        * g++.dg/parse/crash9.C: Likewise.
        * g++.dg/template/crash55.C: Likewise.

From-SVN: r117118
This commit is contained in:
Lee Millward 2006-09-21 18:33:49 +00:00 committed by Lee Millward
parent d2a8ac2cf2
commit 32273f9fa6
6 changed files with 25 additions and 3 deletions

View file

@ -3,6 +3,10 @@
PR c++/28861
* decl.c (shadow_tag): Return error_mark_node
if maybe_process_partial_specialization failed.
PR c++/28303
* decl.c (grokdeclarator): Return error_mark_node on
declaration with two or more data types.
2006-09-20 Danny Smith <dannysmith@users.sourceforge.net>

View file

@ -7117,7 +7117,11 @@ grokdeclarator (const cp_declarator *declarator,
/* If there were multiple types specified in the decl-specifier-seq,
issue an error message. */
if (declspecs->multiple_types_p)
error ("two or more data types in declaration of %qs", name);
{
error ("two or more data types in declaration of %qs", name);
return error_mark_node;
}
/* Extract the basic type from the decl-specifier-seq. */
type = declspecs->type;
if (type == error_mark_node)

View file

@ -3,6 +3,12 @@
PR c++/28861
* g++.dg/template/spec32.C: New test.
* g++.dg/parse/crash9.C: Adjust error markers.
PR c++/28303
* g++.dg/template/typedef6.C: New test.
* g++.dg/init/error1.C: Adjust error markers.
* g++.dg/parse/crash9.C: Likewise.
* g++.dg/template/crash55.C: Likewise.
2006-09-21 Janis Johnson <janis187@us.ibm.com>

View file

@ -1,7 +1,7 @@
// PR c++/12696
struct A {
static float b[10]; // { dg-error "" }
static float b[10];
}
float A::b[] = {1,2,3}; // { dg-error "" }

View file

@ -1,6 +1,6 @@
//PR c++/27668
template<typename class T, T = T()> // { dg-error "nested-name-specifier|two or more|valid type" }
struct A {}; // { dg-error "definition"
struct A {}; // { dg-error "definition|template" }
template<int> void foo(A<int>); // { dg-error "mismatch|constant|template argument" }

View file

@ -0,0 +1,8 @@
//PR c++/28303
template<typename T> struct A
{
typedef struct typename T::X X; // { dg-error "expected identifier|two or more" }
};
template<typename T> A<T>::X::X() {} // { dg-error "not a type|forbids declaration" }