Commit 867a4ad2 by Marek Polacek Committed by Marek Polacek

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.

	* g++.dg/cpp0x/using-enum-3.C: New test.

From-SVN: r269262
parent ec302910
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
......
......@@ -19412,7 +19412,8 @@ cp_parser_using_declaration (cp_parser* parser,
/*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
......
// 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" }
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment