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() { } +};