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

            Bug ID: 95074
           Summary: Function found via ADL when it should not
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

namespace N {
  struct S { };
  void f(S);
}

namespace M {
  void f(int);
}

int
main ()
{
  N::S s;
  extern void f(char); // #1
  using M::f; // #2
  f(s);
}

compiles fine, but shouldn't: [basic.lookup.argdep]/3: If X (the lookup set
produced by unqualified lookup) contains 
-- a block-scope function declaration that is not a using-declaration
[...]
then Y (the lookup set produced by ADL) is empty.

So the M::f here is fine but #1 should prevent ADL.  But we still find N::f.

If lines #1 and #2 are switched, this test rejected.

Reply via email to