re PR c++/60265 ([C++11] using-declaration of enumerator fails if fully qualified)

/cp
2014-06-11  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/60265
	* parser.c (cp_parser_using_declaration): Handle unscoped enums.
	* name-lookup.c (validate_nonmember_using_decl): Adjust error
	message.

/testsuite
2014-06-11  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/60265
	* g++.dg/cpp0x/using-enum-1.C: New.
	* g++.dg/cpp0x/using-enum-2.C: Likewise.

From-SVN: r211479
This commit is contained in:
Paolo Carlini 2014-06-11 17:28:14 +00:00 committed by Paolo Carlini
parent 37251385bf
commit c7bb3484a2
6 changed files with 56 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2014-06-11 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/60265
* parser.c (cp_parser_using_declaration): Handle unscoped enums.
* name-lookup.c (validate_nonmember_using_decl): Adjust error
message.
2014-06-11 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/19200

View File

@ -2487,7 +2487,7 @@ validate_nonmember_using_decl (tree decl, tree scope, tree name)
member-declaration. */
if (TYPE_P (scope))
{
error ("%qT is not a namespace", scope);
error ("%qT is not a namespace or unscoped enum", scope);
return NULL_TREE;
}
else if (scope == error_mark_node)

View File

@ -16022,6 +16022,8 @@ cp_parser_using_declaration (cp_parser* parser,
/*is_declaration=*/true);
if (!qscope)
qscope = global_namespace;
else if (UNSCOPED_ENUM_P (qscope))
qscope = CP_TYPE_CONTEXT (qscope);
if (access_declaration_p && cp_parser_error_occurred (parser))
/* Something has already gone wrong; there's no need to parse

View File

@ -1,3 +1,9 @@
2014-06-11 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/60265
* g++.dg/cpp0x/using-enum-1.C: New.
* g++.dg/cpp0x/using-enum-2.C: Likewise.
2014-06-11 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/19200

View File

@ -0,0 +1,20 @@
// PR c++/60265
// { dg-do compile { target c++11 } }
namespace A
{
enum E { V };
using E::V;
}
void foo()
{
using A::E::V;
}
using A::E::V;
enum F { U };
using F::U;

View File

@ -0,0 +1,20 @@
// PR c++/60265
// { dg-do compile { target c++11 } }
namespace A
{
enum class E { V };
using E::V; // { dg-error "not a namespace or unscoped enum" }
}
void foo()
{
using A::E::V; // { dg-error "not a namespace or unscoped enum" }
}
using A::E::V; // { dg-error "not a namespace or unscoped enum" }
enum class F { U };
using F::U; // { dg-error "not a namespace or unscoped enum" }