This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/65152] New: Several friend function definitions break lookup
- From: "bugger_gcc at interia dot pl" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 21 Feb 2015 03:54:52 +0000
- Subject: [Bug c++/65152] New: Several friend function definitions break lookup
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65152
Bug ID: 65152
Summary: Several friend function definitions break lookup
Product: gcc
Version: 4.9.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: bugger_gcc at interia dot pl
When there is more than one class defining a friend function, name lookup fails
in the enclosing scope.
Live example: http://goo.gl/gwA3ej (also pasted at the bottom).
If either friend function definition at line 7 or 12 is commented out, the code
compiles and the call at line 18 correctly resolves to the global function.
However, with two friend functions defined the call results in compilation
error. The call is also resolved properly with the using declaration at line 17
uncommented, but this shouldn't be necessary since the friend functions
shouldn't alter the visibility of the global function and should only be
accessible via ADL.
The code:
void test(int);
namespace N {
struct A
{
friend void test(A); // line 7
};
struct B
{
friend void test(B); // line 12
};
void f()
{
//using ::test; // line 17
test(0); // line 18
}
}