https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120640
Bug ID: 120640 Summary: Keyword 'typename' should not affect qualified name lookup Product: gcc Version: 15.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: serebrennikov.vladislav at gmail dot com Target Milestone: --- Consider the following example (https://godbolt.org/z/4Tqd84s4M): namespace N { class A {}; int A(); } typename N::A a; // only GCC accepts N::A a2; // everyone rejects I don't see anything in [basic.lookup] to support this behavior (note that 'typename' doesn't form an elaborated type specifier). This is further supported by a note (https://eel.is/c++draft/temp.res.general#note-2): > [Note 2: The usual qualified name lookup ([basic.lookup.qual]) applies even > in the presence of typename. — end note] I checked old GCC versions. It seems that this has been accepted ever since keyword 'typename' was supported outside of class scope, so not a regression in any particular version.