Re: [PATCH] Fix PR c++/59366 A friend function template defined in a class is found without ADL

2015-01-15 Thread Jason Merrill
Applied, thanks. Jason

Re: [PATCH] Fix PR c++/59366 A friend function template defined in a class is found without ADL

2015-01-05 Thread Momchil Velikov
On 5.01.2015 15:55, Jason Merrill wrote: On 12/30/2014 11:24 AM, Momchil Velikov wrote: A function template enters the body of the if statement at line 1881, if (TREE_CODE (newdecl) == TEMPLATE_DECL) and exits the function at line 1951 with return olddecl; Ah, yes. The patch is

Re: [PATCH] Fix PR c++/59366 A friend function template defined in a class is found without ADL

2015-01-05 Thread Jason Merrill
On 12/30/2014 11:24 AM, Momchil Velikov wrote: A function template enters the body of the if statement at line 1881, if (TREE_CODE (newdecl) == TEMPLATE_DECL) and exits the function at line 1951 with return olddecl; Ah, yes. The patch is OK, then, but still needs ChangeLog and tes

Re: [PATCH] Fix PR c++/59366 A friend function template defined in a class is found without ADL

2014-12-30 Thread Momchil Velikov
On 30.12.2014 17:54, Jason Merrill wrote: On 12/28/2014 01:45 PM, Momchil Velikov wrote: + if (!hidden_friend) +{ + DECL_ANTICIPATED (olddecl) = 0; + DECL_HIDDEN_FRIEND_P (olddecl) = 0; +} Why not add this... @@ -2147,10 +2160,6 @@ duplicate_decls (tree newdecl, tree o

Re: [PATCH] Fix PR c++/59366 A friend function template defined in a class is found without ADL

2014-12-30 Thread Jason Merrill
On 12/28/2014 01:45 PM, Momchil Velikov wrote: + if (!hidden_friend) + { + DECL_ANTICIPATED (olddecl) = 0; + DECL_HIDDEN_FRIEND_P (olddecl) = 0; + } Why not add this... @@ -2147,10 +2160,6 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend

Re: [PATCH] Fix PR c++/59366 A friend function template defined in a class is found without ADL

2014-12-28 Thread Momchil Velikov
On 28.12.2014 01:36, Jason Merrill wrote: On 12/27/2014 04:38 PM, Momchil Velikov wrote: + else if (t != x && t != error_mark_node) +{ + /* This is a non-friend re-declaration of a possibly + hidden function or a function template, so don't hide + it. */ +

Re: [PATCH] Fix PR c++/59366 A friend function template defined in a class is found without ADL

2014-12-27 Thread Jason Merrill
On 12/27/2014 04:38 PM, Momchil Velikov wrote: + else if (t != x && t != error_mark_node) + { + /* This is a non-friend re-declaration of a possibly +hidden function or a function template, so don't hide +it. */ + DECL_ANTI

Re: [PATCH] Fix PR c++/59366 A friend function template defined in a class is found without ADL

2014-12-27 Thread Momchil Velikov
Ping On 5.05.2014 13:06, Momchil Velikov wrote: Hello, A friend function, defined in a class and not declared outside should be hidden from ordinary name lookup and only found by argument-dependent lookup, like: struct S { friend void f() {} friend void g(const S &) {} }; int main()

Re: [PATCH] Fix PR c++/59366 A friend function template defined in a class is found without ADL

2014-05-05 Thread Momchil Velikov
Bootstrapped/regtested on x86_64-linux-gnu. One test, gcc/testsuite/g++.old-deja/g++.pt/friend5.C, breaks, as it should, and was fixed. ~chill

[PATCH] Fix PR c++/59366 A friend function template defined in a class is found without ADL

2014-05-05 Thread Momchil Velikov
Hello, A friend function, defined in a class and not declared outside should be hidden from ordinary name lookup and only found by argument-dependent lookup, like: struct S { friend void f() {} friend void g(const S &) {} }; int main() { f(); // error g(S()); // correct, found by AD