Commit dcbdf612 by Simon Martin Committed by Simon Martin

re PR c++/37555 (ICE with invalid typedef)

gcc/cp/

2008-09-30  Simon Martin  <simartin@users.sourceforge.net>

	    PR c++/37555
	    PR c++/37556
	    * decl.c (grokdeclarator): Set the type for typedefs to a
	    nested-name-specifier to error_mark_node.

gcc/testsuite/

2008-09-30  Simon Martin  <simartin@users.sourceforge.net>

	    PR c++/37555
	    * g++.dg/parse/error32.C: New test.

	    PR c++/37556
	    * g++.dg/parse/error33.C: New test.

From-SVN: r140794
parent 61b70fcb
2008-09-30 Simon Martin <simartin@users.sourceforge.net>
PR c++/37555
PR c++/37556
* decl.c (grokdeclarator): Set the type for typedefs to a
nested-name-specifier to error_mark_node.
2008-09-30 Paolo Bonzini <bonzini@gnu.org>
* parser.c (cp_parser_selection_statement): Implement here the
......
......@@ -8679,8 +8679,10 @@ grokdeclarator (const cp_declarator *declarator,
decl = build_lang_decl (TYPE_DECL, unqualified_id, type);
else
decl = build_decl (TYPE_DECL, unqualified_id, type);
if (id_declarator && declarator->u.id.qualifying_scope)
if (id_declarator && declarator->u.id.qualifying_scope) {
error ("%Jtypedef name may not be a nested-name-specifier", decl);
TREE_TYPE (decl) = error_mark_node;
}
if (decl_context != FIELD)
{
......
2008-09-30 Simon Martin <simartin@users.sourceforge.net>
PR c++/37555
* g++.dg/parse/error32.C: New test.
PR c++/37556
* g++.dg/parse/error33.C: New test.
2008-09-30 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/37662
......
/* PR c++/37555 */
/* { dg-do "compile" } */
struct A {};
typedef void (A::T)(); /* { dg-error "typedef name may not be a nested-name-specifier" } */
void foo()
{
T t;
t; /* { dg-error "was not declared" } */
}
/* PR c++/37556 */
/* { dg-do "compile" } */
struct A
{
void foo();
};
typedef void (A::T)(); /* { dg-error "typedef name may not be a nested" } */
void bar(T); /* { dg-error "too many arguments" } */
void baz()
{
bar(&A::foo); /* { dg-error "at this point" } */
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment