[Bug c++/95074] New: Function found via ADL when it should not

mpolacek at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue May 12 05:17:31 GMT 2020


            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);

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

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.

More information about the Gcc-bugs mailing list