Commit 3b4a12aa by Paolo Carlini Committed by Paolo Carlini

re PR c++/84792 (ICE with broken typedef of a struct)

/cp
2018-04-05  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/84792
	* decl.c (grokdeclarator): Fix diagnostic about typedef name used
	as nested-name-specifier, keep type and TREE_TYPE (decl) in sync.

/testsuite
2018-04-05  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/84792
	* g++.dg/other/pr84792-1.C: New.
	* g++.dg/other/pr84792-2.C: Likewise.

From-SVN: r259136
parent 970d3d90
2018-04-05 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/84792
* decl.c (grokdeclarator): Fix diagnostic about typedef name used
as nested-name-specifier, keep type and TREE_TYPE (decl) in sync.
2018-04-05 Jason Merrill <jason@redhat.com>
PR c++/82152 - ICE with class deduction and inherited ctor.
......
......@@ -11766,15 +11766,16 @@ grokdeclarator (const cp_declarator *declarator,
if (reqs)
error_at (location_of (reqs), "requires-clause on typedef");
if (id_declarator && declarator->u.id.qualifying_scope)
{
error ("typedef name may not be a nested-name-specifier");
type = error_mark_node;
}
if (decl_context == FIELD)
decl = build_lang_decl (TYPE_DECL, unqualified_id, type);
else
decl = build_decl (input_location, TYPE_DECL, unqualified_id, type);
if (id_declarator && declarator->u.id.qualifying_scope) {
error_at (DECL_SOURCE_LOCATION (decl),
"typedef name may not be a nested-name-specifier");
TREE_TYPE (decl) = error_mark_node;
}
if (decl_context != FIELD)
{
......
2018-04-05 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/84792
* g++.dg/other/pr84792-1.C: New.
* g++.dg/other/pr84792-2.C: Likewise.
2018-04-05 Uros Bizjak <ubizjak@gmail.com>
PR target/85193
......
struct A {};
typedef struct
{
virtual void foo() {}
} A::B; // { dg-error "typedef" }
struct A {};
typedef struct
{
void foo() {}
} A::B; // { dg-error "typedef" }
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