Commit b60f3408 by Jason Merrill Committed by Jason Merrill

re PR c++/48935 ([C++0x] Name lookup error at enum class)

	PR c++/48935
	* parser.c (cp_parser_constructor_declarator_p): Don't check
	constructor_name_p for enums.
	(cp_parser_diagnose_invalid_type_name): Correct error message.

From-SVN: r174205
parent f41349a3
2011-05-25 Jason Merrill <jason@redhat.com> 2011-05-25 Jason Merrill <jason@redhat.com>
PR c++/48935
* parser.c (cp_parser_constructor_declarator_p): Don't check
constructor_name_p for enums.
(cp_parser_diagnose_invalid_type_name): Correct error message.
PR c++/45418 PR c++/45418
* init.c (perform_member_init): Handle list-initialization * init.c (perform_member_init): Handle list-initialization
of array of non-trivial class type. of array of non-trivial class type.
......
...@@ -2534,7 +2534,7 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser, ...@@ -2534,7 +2534,7 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser,
"%qT is a dependent scope", "%qT is a dependent scope",
parser->scope, id, parser->scope); parser->scope, id, parser->scope);
else if (TYPE_P (parser->scope)) else if (TYPE_P (parser->scope))
error_at (location, "%qE in class %qT does not name a type", error_at (location, "%qE in %q#T does not name a type",
id, parser->scope); id, parser->scope);
else else
gcc_unreachable (); gcc_unreachable ();
...@@ -19589,7 +19589,7 @@ cp_parser_constructor_declarator_p (cp_parser *parser, bool friend_p) ...@@ -19589,7 +19589,7 @@ cp_parser_constructor_declarator_p (cp_parser *parser, bool friend_p)
/* If we have a class scope, this is easy; DR 147 says that S::S always /* If we have a class scope, this is easy; DR 147 says that S::S always
names the constructor, and no other qualified name could. */ names the constructor, and no other qualified name could. */
if (constructor_p && nested_name_specifier if (constructor_p && nested_name_specifier
&& TYPE_P (nested_name_specifier)) && CLASS_TYPE_P (nested_name_specifier))
{ {
tree id = cp_parser_unqualified_id (parser, tree id = cp_parser_unqualified_id (parser,
/*template_keyword_p=*/false, /*template_keyword_p=*/false,
......
2011-05-25 Jason Merrill <jason@redhat.com> 2011-05-25 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/enum16.C: New.
* g++.dg/parse/error15.C: Adjust.
* g++.dg/cpp0x/initlist50.C: New. * g++.dg/cpp0x/initlist50.C: New.
* g++.dg/cpp0x/lambda/lambda-conv5.C: New. * g++.dg/cpp0x/lambda/lambda-conv5.C: New.
......
// PR c++/48935
// { dg-options -std=c++0x }
enum class ENUM { a };
ENUM::Type func() { return ENUM::a; } // { dg-error "does not name a type" }
...@@ -12,7 +12,7 @@ namespace N ...@@ -12,7 +12,7 @@ namespace N
N::A f2; // { dg-error "1:invalid use of template-name 'N::A' without an argument list" } N::A f2; // { dg-error "1:invalid use of template-name 'N::A' without an argument list" }
N::INVALID f3; // { dg-error "1:'INVALID' in namespace 'N' does not name a type" } N::INVALID f3; // { dg-error "1:'INVALID' in namespace 'N' does not name a type" }
N::C::INVALID f4; // { dg-error "1:'INVALID' in class 'N::C' does not name a type" } N::C::INVALID f4; // { dg-error "1:'INVALID' in 'struct N::C' does not name a type" }
N::K f6; // { dg-error "1:'K' in namespace 'N' does not name a type" } N::K f6; // { dg-error "1:'K' in namespace 'N' does not name a type" }
typename N::A f7; typename N::A f7;
// { dg-error "13:invalid use of template-name 'N::A' without an argument list" "13" { target *-*-* } 17 } // { dg-error "13:invalid use of template-name 'N::A' without an argument list" "13" { target *-*-* } 17 }
...@@ -22,7 +22,7 @@ struct B ...@@ -22,7 +22,7 @@ struct B
{ {
N::A f2; // { dg-error "3:invalid use of template-name 'N::A' without an argument list" } N::A f2; // { dg-error "3:invalid use of template-name 'N::A' without an argument list" }
N::INVALID f3; // { dg-error "3:'INVALID' in namespace 'N' does not name a type" } N::INVALID f3; // { dg-error "3:'INVALID' in namespace 'N' does not name a type" }
N::C::INVALID f4; // { dg-error "3:'INVALID' in class 'N::C' does not name a type" } N::C::INVALID f4; // { dg-error "3:'INVALID' in 'struct N::C' does not name a type" }
N::K f6; // { dg-error "3:'K' in namespace 'N' does not name a type" } N::K f6; // { dg-error "3:'K' in namespace 'N' does not name a type" }
typename N::A f7; typename N::A f7;
// { dg-error "15:invalid use of template-name 'N::A' without an argument list" "15" { target *-*-* } 27 } // { dg-error "15:invalid use of template-name 'N::A' without an argument list" "15" { target *-*-* } 27 }
...@@ -33,7 +33,7 @@ struct C ...@@ -33,7 +33,7 @@ struct C
{ {
N::A f2; // { dg-error "3:invalid use of template-name 'N::A' without an argument list" } N::A f2; // { dg-error "3:invalid use of template-name 'N::A' without an argument list" }
N::INVALID f3; // { dg-error "3:'INVALID' in namespace 'N' does not name a type" } N::INVALID f3; // { dg-error "3:'INVALID' in namespace 'N' does not name a type" }
N::C::INVALID f4; // { dg-error "3:'INVALID' in class 'N::C' does not name a type" } N::C::INVALID f4; // { dg-error "3:'INVALID' in 'struct N::C' does not name a type" }
N::K f6; // { dg-error "3:'K' in namespace 'N' does not name a type" } N::K f6; // { dg-error "3:'K' in namespace 'N' does not name a type" }
typename N::A f7; // { dg-error "15:invalid use of template-name 'N::A' without an argument list" } typename N::A f7; // { dg-error "15:invalid use of template-name 'N::A' without an argument list" }
}; };
......
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