From: David Krauss Date: Tue, 14 Apr 2015 15:29:27 +0000 (+0000) Subject: re PR c++/59766 (c++1y: declaring friend function with 'auto' return type deduction... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=688e531e4b84d9250646715658179a5f72753609;p=gcc.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: r222095 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2e43e4d100e..10df58f0bee 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2015-04-14 David Krauss + + PR c++/59766 + * decl.c (grokdeclarator): Do not flag friends with deduced return. + 2015-04-14 Momchil Velikov Jason Merrill diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index c4731ae2416..c8323b0e9a4 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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 %"); 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 00000000000..17f232fde99 --- /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() { } +};