Commit de721390 by Jason Merrill Committed by Jason Merrill

re PR c++/47635 ([C++0x] ICE on invalid code in constructor_name_p, at cp/name-lookup.c:1809)

	PR c++/47635
	* decl.c (grokdeclarator): Don't set ctype to an ENUMERAL_TYPE.

From-SVN: r175216
parent 05322543
2011-06-20 Jason Merrill <jason@redhat.com> 2011-06-20 Jason Merrill <jason@redhat.com>
PR c++/47635
* decl.c (grokdeclarator): Don't set ctype to an ENUMERAL_TYPE.
PR c++/48138 PR c++/48138
* tree.c (strip_typedefs): Use build_aligned_type. * tree.c (strip_typedefs): Use build_aligned_type.
......
...@@ -8338,10 +8338,15 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -8338,10 +8338,15 @@ grokdeclarator (const cp_declarator *declarator,
else if (TYPE_P (qualifying_scope)) else if (TYPE_P (qualifying_scope))
{ {
ctype = qualifying_scope; ctype = qualifying_scope;
if (innermost_code != cdk_function if (!MAYBE_CLASS_TYPE_P (ctype))
&& current_class_type {
&& !UNIQUELY_DERIVED_FROM_P (ctype, error ("%q#T is not a class or a namespace", ctype);
current_class_type)) ctype = NULL_TREE;
}
else if (innermost_code != cdk_function
&& current_class_type
&& !UNIQUELY_DERIVED_FROM_P (ctype,
current_class_type))
{ {
error ("type %qT is not derived from type %qT", error ("type %qT is not derived from type %qT",
ctype, current_class_type); ctype, current_class_type);
...@@ -9350,7 +9355,7 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -9350,7 +9355,7 @@ grokdeclarator (const cp_declarator *declarator,
would not have exited the loop above. */ would not have exited the loop above. */
if (declarator if (declarator
&& declarator->u.id.qualifying_scope && declarator->u.id.qualifying_scope
&& TYPE_P (declarator->u.id.qualifying_scope)) && MAYBE_CLASS_TYPE_P (declarator->u.id.qualifying_scope))
{ {
tree t; tree t;
...@@ -10156,13 +10161,6 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -10156,13 +10161,6 @@ grokdeclarator (const cp_declarator *declarator,
"declared out of global scope", name); "declared out of global scope", name);
} }
if (ctype != NULL_TREE
&& TREE_CODE (ctype) != NAMESPACE_DECL && !MAYBE_CLASS_TYPE_P (ctype))
{
error ("%q#T is not a class or a namespace", ctype);
ctype = NULL_TREE;
}
if (ctype == NULL_TREE) if (ctype == NULL_TREE)
{ {
if (virtualp) if (virtualp)
......
2011-06-20 Jason Merrill <jason@redhat.com> 2011-06-20 Jason Merrill <jason@redhat.com>
PR c++/47635
* g++.dg/cpp0x/enum20.C: New.
PR c++/48138 PR c++/48138
* g++.dg/ext/attr-aligned01.C: New. * g++.dg/ext/attr-aligned01.C: New.
......
// PR c++/47635
// { dg-options -std=c++0x }
enum A { };
void A::f() { } // { dg-error "not a class" }
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