This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c++/2949: incorrect Koenig lookup of friend functions



>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:
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]