https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116770
Bug ID: 116770 Summary: Diagnostic 'explicit qualification in declaration of' could be clearer when explicit namespace qualifier matches the open namespace Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: cjdb.ns at gmail dot com Target Milestone: --- ``` namespace foo { void f(); } namespace foo { void foo::f() {} } ``` gives this diagnostic ``` error: explicit qualification in declaration of 'void foo::f()' 6 | void foo::f() {} | ^~~ ``` While technically accurate, the diagnostic could go a bit further and diagnose that the author might have meant to define `foo::f`. Would it be possible to add a note please? ``` error: explicit qualification in declaration of 'void foo::f()' 6 | void foo::f() {} | ^~~ note: this 'void foo::f()` was found inside a 'namespace foo' block; did you mean 'void f()`? ``` Alternatively, Clang diagnoses this as a warning instead of an error; perhaps GCC could match this, either in text or in functionality. ``` warning: extra qualification on member 'f' [-Wextra-qualification] 6 | void foo::f() {} | ^ ```