public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95074] New: Function found via ADL when it should not
@ 2020-05-12  5:17 mpolacek at gcc dot gnu.org
  2020-05-12  5:18 ` [Bug c++/95074] " mpolacek at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-05-12  5:17 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-12-03  0:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-12  5:17 [Bug c++/95074] New: Function found via ADL when it should not mpolacek at gcc dot gnu.org
2020-05-12  5:18 ` [Bug c++/95074] " mpolacek at gcc dot gnu.org
2020-05-12  5:31 ` mpolacek at gcc dot gnu.org
2020-05-12  8:50 ` redi at gcc dot gnu.org
2020-05-12 15:00 ` mpolacek at gcc dot gnu.org
2020-05-12 20:26 ` cvs-commit at gcc dot gnu.org
2020-05-12 20:27 ` mpolacek at gcc dot gnu.org
2021-12-03  0:54 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).