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:
parent
fefedb945e
commit
1a142d6e68
@ -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
|
||||
|
@ -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
|
||||
|
25
gcc/testsuite/g++.dg/cpp0x/scoped_enum8.C
Normal file
25
gcc/testsuite/g++.dg/cpp0x/scoped_enum8.C
Normal 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 ();
|
||||
}
|
Loading…
Reference in New Issue
Block a user