This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/2949: incorrect Koenig lookup of friend functions
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/2949: incorrect Koenig lookup of friend functions
- From: Jens dot Maurer at gmx dot net
- Date: 25 May 2001 22:37:50 -0000
- Cc: rwgk at cci dot lbl dot gov, abrahams at altrabroadband dot com
- Reply-To: Jens dot Maurer at gmx dot net
>Number: 2949
>Category: c++
>Synopsis: incorrect Koenig lookup of friend functions
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: accepts-illegal
>Submitter-Id: net
>Arrival-Date: Fri May 25 15:46:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Jens Maurer
>Release: gcc version 3.0 20010521 (prerelease)
>Organization:
>Environment:
Linux 2.4.4
glibc 2.2.3
>Description:
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.
>How-To-Repeat:
namespace N {
struct A { };
struct X {
friend void f(A) { }
};
}
int main()
{
N::A a;
f(a); // must not find N::f(A)
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: