Here the code for 'using enum' is confused by the combination of a
using-decl and an enum that are not from 'using enum'; this CONST_DECL is
from the normal unscoped enum scoping.
PR c++/100659
gcc/cp/ChangeLog:
* cp-tree.h (CONST_DECL_USING_P): Check for null TREE_TYPE.
gcc/testsuite/ChangeLog:
* g++.dg/parse/access13.C: New test.
created by handle_using_decl. */
#define CONST_DECL_USING_P(NODE) \
(TREE_CODE (NODE) == CONST_DECL \
+ && TREE_TYPE (NODE) \
&& TREE_CODE (TREE_TYPE (NODE)) == ENUMERAL_TYPE \
&& DECL_CONTEXT (NODE) != TREE_TYPE (NODE))
--- /dev/null
+// PR c++/100659
+
+template <typename> struct A
+{
+ A::E::V; // { dg-warning "access decl" }
+ enum { V }; // { dg-error "conflicts with a previous decl" }
+};