https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31336
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |msebor at gcc dot gnu.org Blocks| |12944 Resolution|--- |DUPLICATE --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- In the originally submitted test program, both GCC 7 and EDG eccp 4.11 accept all cases but #5. Clang 3.8 also rejects #5 and #7. Below is a reduced test case that reproduces the same behavior. By my reading, case #5 is invalid but case #7 is valid because the friend function bar is found by argument dependent lookup. The invalid case wasn't handled correctly until r219689 committed to resolve bug 59366. Closing as duplicate of that bug. So I'm inclined to resolve this bug as fixed. $ cat t.C && gcc -S -Wall -Wextra t.C struct Foo { }; struct Bar { template <class T> friend void bar (const T&, int); }; int main () { Foo f; bar (1, 5); bar (f, 7); } t.C: In function ‘int main()’: t.C:13:3: error: ‘bar’ was not declared in this scope bar (1, 5); ^~~ *** This bug has been marked as a duplicate of bug 59366 *** Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=12944 [Bug 12944] [meta-bug] C++ name-lookup problems