c++: Fix bogus "does not declare anything" warning (PR 66159)
G++ gives a bogus warning for 'struct A; using B = struct ::A;'
complaining that the elaborated-type-specifier doesn't declare anything.
That's true, but it's not trying to declare struct ::A, just refer to it
unambiguously. Do not emit the warning unless we're actually parsing a
declaration.
gcc/cp/ChangeLog:
PR c++/66159
* parser.c (cp_parser_elaborated_type_specifier): Do not warn
unless in a declaration.
gcc/testsuite/ChangeLog:
PR c++/66159
* g++.dg/warn/forward-inner.C: Check alias-declaration using
elaborated-type-specifier.