PR c++/85587 - error with scoped enum in template.

* semantics.c (finish_qualified_id_expr): Don't return an
	unqualified IDENTIFIER_NODE.

From-SVN: r259805
This commit is contained in:
Jason Merrill 2018-05-01 14:11:53 -04:00 committed by Jason Merrill
parent fefedb945e
commit 1a142d6e68
3 changed files with 33 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2018-05-01 Jason Merrill <jason@redhat.com>
PR c++/85587 - error with scoped enum in template.
* semantics.c (finish_qualified_id_expr): Don't return an
unqualified IDENTIFIER_NODE.
2018-04-30 Jason Merrill <jason@redhat.com>
PR c++/85580 - extern "C" and local variables

View File

@ -2061,7 +2061,8 @@ finish_qualified_id_expr (tree qualifying_class,
}
/* No need to check access within an enum. */
if (TREE_CODE (qualifying_class) == ENUMERAL_TYPE)
if (TREE_CODE (qualifying_class) == ENUMERAL_TYPE
&& TREE_CODE (expr) != IDENTIFIER_NODE)
return expr;
/* Within the scope of a class, turn references to non-static

View File

@ -0,0 +1,25 @@
// PR c++/85587
// { dg-do compile { target c++11 } }
template <int N>
struct S
{
enum class T
{
E, F
};
void foo ();
};
template <int N>
void S<N>::foo ()
{
decltype (T::F) t;
}
void
bar ()
{
S<0> s;
s.foo ();
}