User account creation filtered due to spam.

Bug 2949 - incorrect Koenig lookup of friend functions
Summary: incorrect Koenig lookup of friend functions
Status: RESOLVED DUPLICATE of bug 7874
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Keywords: accepts-invalid, monitored
Depends on:
Blocks: 12944
  Show dependency treegraph
Reported: 2001-05-25 15:46 UTC by Jens Maurer
Modified: 2003-12-28 04:36 UTC (History)
4 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2003-11-03 04:13:42


Note You need to log in before you can comment on or make changes to this bug.
Description Jens Maurer 2001-05-25 15:46:00 UTC
The attached program is accepted, although the C++ standard
clearly specifies in section 3.4.2p3 second bullet that
only "friend functions declared in associated classes"
are visible to argument-dependent lookup.

However, N::X is not an associated class.

Also erroneously accepted by
gcc version 3.1 20010518 (experimental)

See also core issue 143 for a related clarification.

gcc version 3.0 20010521 (prerelease)

Linux 2.4.4
glibc 2.2.3

namespace N {
  struct A { };
  struct X {
    friend void f(A) { }

int main()
  N::A a;
  f(a);  // must not find N::f(A)
Comment 1 Nathan Sidwell 2001-05-27 09:18:06 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: confirmed as a bug
Comment 2 Nathan Sidwell 2001-05-27 16:18:06 UTC
Subject: Re: c++/2949
Date: 27 May 2001 16:18:06 -0000

 Synopsis: incorrect Koenig lookup of friend functions
 State-Changed-From-To: open->analyzed
 State-Changed-By: nathan
 State-Changed-When: Sun May 27 09:18:06 2001
     confirmed as a bug
Comment 3 Andrew Pinski 2003-06-08 05:54:31 UTC
Still exists on the mainline (20030607).
Comment 4 Andrew Pinski 2003-12-28 04:36:35 UTC
This is a dup of bug 7874.

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