* parser.c (cp_parser_using_declaration): For an unscoped enum
only use its context if it's not a function declaration.
* g++.dg/cpp0x/using-enum-3.C: New test.
From-SVN: r269262
+2019-02-27 Marek Polacek <polacek@redhat.com>
+
+ PR c++/89511 - ICE with using-declaration and unscoped enumerator.
+ * parser.c (cp_parser_using_declaration): For an unscoped enum
+ only use its context if it's not a function declaration.
+
2019-02-27 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/89488
/*is_declaration=*/true);
if (!qscope)
qscope = global_namespace;
- else if (UNSCOPED_ENUM_P (qscope))
+ else if (UNSCOPED_ENUM_P (qscope)
+ && !TYPE_FUNCTION_SCOPE_P (qscope))
qscope = CP_TYPE_CONTEXT (qscope);
if (access_declaration_p && cp_parser_error_occurred (parser))
+2019-02-27 Marek Polacek <polacek@redhat.com>
+
+ PR c++/89511 - ICE with using-declaration and unscoped enumerator.
+ * g++.dg/cpp0x/using-enum-3.C: New test.
+
2019-02-27 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/89280
--- /dev/null
+// PR c++/89511
+// { dg-do compile { target c++11 } }
+
+void f ()
+{
+ enum e { a };
+ using e::a; // { dg-error "not a namespace or unscoped enum" }
+}
+
+struct S {
+ enum E { A };
+ using E::A; // { dg-error "type .S. is not a base type for type .S." }
+};
+
+namespace N {
+ enum E { B };
+}
+
+struct T {
+ using N::E::B; // { dg-error "using-declaration for non-member at class scope" }
+};