https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95302
Rafael Avila de Espindola <rafael at espindo dot la> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rafael at espindo dot la --- Comment #2 from Rafael Avila de Espindola <rafael at espindo dot la> --- The same problem happens with a namespace alias: namespace foo { void bar(); } [[deprecated("zed")]] inline void zed() { namespace a = foo; a::bar(); } Produces: test.cc: In function ‘void zed()’: test.cc:6:8: warning: ‘void zed()’ is deprecated: zed [-Wdeprecated-declarations] 6 | a::bar(); | ^~~ test.cc:4:35: note: declared here 4 | [[deprecated("zed")]] inline void zed() { | ^~~ If instead of the alias foo::bar() is used directly, no warning is produced. The issue is still present on current master (346bce6fe0cf1ed5f6a7ad732d2361d77b203c87).