An alias can't be declared with a qualified-id in actual code, but in diagnostics we want to know which scope it belongs to, and I think a nested-name-specifier is the best way to provide that.
Tested x86_64-pc-linux-gnu, applying to trunk. gcc/cp/ChangeLog: * error.cc (dump_decl): Check TFF_UNQUALIFIED_NAME. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/alias-decl-1.C: Expect qualified name. --- gcc/cp/error.cc | 2 ++ gcc/testsuite/g++.dg/cpp0x/alias-decl-1.C | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/gcc/cp/error.cc b/gcc/cp/error.cc index 1e944ca3f75..2b07136b5ca 100644 --- a/gcc/cp/error.cc +++ b/gcc/cp/error.cc @@ -1246,6 +1246,8 @@ dump_decl (cxx_pretty_printer *pp, tree t, int flags) || flags & TFF_CLASS_KEY_OR_ENUM)) { pp_cxx_ws_string (pp, "using"); + if (! (flags & TFF_UNQUALIFIED_NAME)) + dump_scope (pp, CP_DECL_CONTEXT (t), flags); dump_decl (pp, DECL_NAME (t), flags); pp_cxx_whitespace (pp); pp_cxx_ws_string (pp, "="); diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-1.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-1.C index 24b05209223..6dcb780e895 100644 --- a/gcc/testsuite/g++.dg/cpp0x/alias-decl-1.C +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-1.C @@ -12,5 +12,5 @@ template<class U> struct Ptr<U*> {}; // { dg-error "specialization" } struct A { using A = int; // { dg-error "11:ISO C\\+\\+ forbids nested type .A." } -// { dg-error "11:.using A = int. has the same name as" "" { target c++11 } .-1 } +// { dg-error "11:.using A::A = int. has the same name as" "" { target c++11 } .-1 } }; base-commit: a282da2243103d79262ca04f5e3a3cc7b9b06935 -- 2.27.0