mirror of git://gcc.gnu.org/git/gcc.git
				
				
				
			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:
		
							parent
							
								
									37251385bf
								
							
						
					
					
						commit
						c7bb3484a2
					
				|  | @ -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> | 2014-06-11  Paolo Carlini  <paolo.carlini@oracle.com> | ||||||
| 
 | 
 | ||||||
| 	PR c++/19200 | 	PR c++/19200 | ||||||
|  |  | ||||||
|  | @ -2487,7 +2487,7 @@ validate_nonmember_using_decl (tree decl, tree scope, tree name) | ||||||
|        member-declaration.  */ |        member-declaration.  */ | ||||||
|   if (TYPE_P (scope)) |   if (TYPE_P (scope)) | ||||||
|     { |     { | ||||||
|       error ("%qT is not a namespace", scope); |       error ("%qT is not a namespace or unscoped enum", scope); | ||||||
|       return NULL_TREE; |       return NULL_TREE; | ||||||
|     } |     } | ||||||
|   else if (scope == error_mark_node) |   else if (scope == error_mark_node) | ||||||
|  |  | ||||||
|  | @ -16022,6 +16022,8 @@ cp_parser_using_declaration (cp_parser* parser, | ||||||
| 						  /*is_declaration=*/true); | 						  /*is_declaration=*/true); | ||||||
|   if (!qscope) |   if (!qscope) | ||||||
|     qscope = global_namespace; |     qscope = global_namespace; | ||||||
|  |   else if (UNSCOPED_ENUM_P (qscope)) | ||||||
|  |     qscope = CP_TYPE_CONTEXT (qscope); | ||||||
| 
 | 
 | ||||||
|   if (access_declaration_p && cp_parser_error_occurred (parser)) |   if (access_declaration_p && cp_parser_error_occurred (parser)) | ||||||
|     /* Something has already gone wrong; there's no need to parse
 |     /* Something has already gone wrong; there's no need to parse
 | ||||||
|  |  | ||||||
|  | @ -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> | 2014-06-11  Paolo Carlini  <paolo.carlini@oracle.com> | ||||||
| 
 | 
 | ||||||
| 	PR c++/19200 | 	PR c++/19200 | ||||||
|  |  | ||||||
|  | @ -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; | ||||||
|  | @ -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" }
 | ||||||
		Loading…
	
		Reference in New Issue
	
	 Paolo Carlini
						Paolo Carlini