https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52771
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|accepts-invalid | --- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- clang accepts this without a murmur. EDG warns about the ambiguous lookup result: "52771.C", line 13: warning: ambiguous class member reference -- type "foo::foo" (declared at line 1) used in preference to class "foo" (declared at line 9) return px->foo::A(); ^ I think this is actually undefined, because the meaning of foo changes and that violates [basic.scope.class] p2: "A name N used in a class S shall refer to the same declaration in its context and when re-evaluated in the completed scope of S. No diagnostic is required for a violation of this rule." Compilers are not required to diagnose violations of this rule, it's just undefined (but see https://wg21.link/p1697r0 for a proposal to require a diagnostic).