diff options
author | David Krauss <david_work@me.com> | 2015-04-14 15:29:27 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2015-04-14 11:29:27 -0400 |
commit | 688e531e4b84d9250646715658179a5f72753609 (patch) | |
tree | a32a497ef0a398c352a42a0e75a8905ce2ec5f3b /gcc | |
parent | 2fd16d0f9007f2e9a991b80c6ae2e4c5f85272b6 (diff) | |
download | gcc-688e531e4b84d9250646715658179a5f72753609.zip gcc-688e531e4b84d9250646715658179a5f72753609.tar.gz gcc-688e531e4b84d9250646715658179a5f72753609.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/decl.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/auto-fn26.C | 6 |
3 files changed, 12 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2e43e4d..10df58f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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> diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index c4731ae2..c8323b0 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 %<auto%>"); 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 0000000..17f232f --- /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() { } +}; |