From: David Krauss Date: Thu, 23 Apr 2015 13:21:06 +0000 (+0000) Subject: re PR c++/59766 (c++1y: declaring friend function with 'auto' return type deduction... X-Git-Tag: releases/gcc-4.9.3~193 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aeed12908d2a2cd8288b59b0478c5942477da76e;p=thirdparty%2Fgcc.git 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: r222365 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3af9ee36e1a6..db4228f1fa29 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2015-04-23 David Krauss + + PR c++/59766 + * decl.c (grokdeclarator): Do not flag friends with deduced return. + 2015-03-26 Mikhail Maltsev PR c++/65154 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index b0bbf9e4fb25..46cd58f95b93 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -10448,7 +10448,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 %"); diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-fn26.C b/gcc/testsuite/g++.dg/cpp1y/auto-fn26.C new file mode 100644 index 000000000000..17f232fde996 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/auto-fn26.C @@ -0,0 +1,6 @@ +// PR c++/59766 +// { dg-do compile { target c++14 } } + +struct T { + friend auto f() { } +};