Bug 36883 - Overeager ADL again
Summary: Overeager ADL again
Status: RESOLVED DUPLICATE of bug 29131
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.3.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2008-07-20 19:36 UTC by Dave Abrahams
Modified: 2011-05-20 15:56 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-03-03 20:58:20


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Abrahams 2008-07-20 19:36:03 UTC
If I understand correctly, the following should not compile, because normal lookup is supposed to look backwards from the calling template's point-of-definition.  There's nothing to make foo an associated namespace of boo::X.

namespace boo
{
  struct X {};
}

namespace foo
{
  template <class T>
  void bar( T x )
  {
      baz(x); // <== should fail here
  }

  void baz(boo::X) {}
}

int main()
{
    foo::bar( boo::X() );
}
Comment 1 Andrew Pinski 2008-08-17 00:16:57 UTC
I think the issue is we don't disquish between an empty overloaded set and one that needs to be looked up later.
Comment 2 Jason Merrill 2009-03-03 20:58:20 UTC
I agree this is a bug: [temp.dep.candidate] says

For the part of the lookup using unqualified name lookup (3.4.1), only function declarations with external linkage from the template definition context are found.

EDG also gets this wrong currently.
Comment 3 Jason Merrill 2011-05-20 15:56:21 UTC
This is another instance of 29131.

*** This bug has been marked as a duplicate of bug 29131 ***