re PR c++/59766 (c++1y: declaring friend function with 'auto' return type deduction is rejected with bogus reason)

PR c++/59766
	* decl.c (grokdeclarator): Do not flag friends with deduced return.

From-SVN: r222095
This commit is contained in:
David Krauss 2015-04-14 15:29:27 +00:00 committed by Jason Merrill
parent 2fd16d0f90
commit 688e531e4b
3 changed files with 12 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2015-04-14 David Krauss <david_work@me.com>
PR c++/59766
* decl.c (grokdeclarator): Do not flag friends with deduced return.
2015-04-14 Momchil Velikov <momchil.velikov@gmail.com>
Jason Merrill <jason@redhat.com>

View File

@ -10628,7 +10628,7 @@ grokdeclarator (const cp_declarator *declarator,
}
else if (decl_context == FIELD)
{
if (!staticp && TREE_CODE (type) != METHOD_TYPE
if (!staticp && !friendp && TREE_CODE (type) != METHOD_TYPE
&& type_uses_auto (type))
{
error ("non-static data member declared %<auto%>");

View File

@ -0,0 +1,6 @@
// PR c++/59766
// { dg-do compile { target c++14 } }
struct T {
friend auto f() { }
};