https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84709

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Right, it's not relevant. The rule is not really about hiding ::Foo and making
a name inaccessible, it's about the name "Foo" changing meaning in the class
scope.

Consider:

struct Foo { };

struct Bar {
  Foo f1 = Foo();
  const Foo &Foo() const;
  Foo f2 = Foo();    
};

At the point of declaration of f1 Foo() means constructing a ::Foo object (and
whether that is really A::Foo is irrelevant) and at the point of declaration of
f2 it means calling the Bar::Foo() function. The meaning of Foo has changed,
and so the class is ill-formed.

Reply via email to