https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105099
Bug ID: 105099
Summary: In lookup for namespace name qualifiers only
namespaces should be considered
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: vanyacpp at gmail dot com
Target Milestone: ---
Consider this code:
namespace a
{
namespace c
{}
struct a
{};
namespace b = a::c; // (1)
using namespace a::c; // (2)
}
Currently GCC prints an error:
file.cpp:9:22: error: 'c' is not a namespace-name
9 | namespace b = a::c;
| ^
file.cpp:10:24: error: 'c' is not a namespace-name
10 | using namespace a::c;
| ^
If I interpret the standard correctly the code should compile without errors
because during the lookup of the qualifier the struct "a" should be ignored and
the namespace "a" should be found.
[basic.lookup.udir]p1: In a using-directive or namespace-alias-definition,
during the lookup for a namespace-name or for a name in a nested-name-specifier
only namespace names are considered.
https://eel.is/c++draft/basic.lookup.udir
https://godbolt.org/z/vaWjx4cKj