]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/59766 (c++1y: declaring friend function with 'auto' return type deduction...
authorDavid Krauss <david_work@me.com>
Thu, 23 Apr 2015 13:21:06 +0000 (13:21 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 23 Apr 2015 13:21:06 +0000 (09:21 -0400)
PR c++/59766
* decl.c (grokdeclarator): Do not flag friends with deduced return.

From-SVN: r222365

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/g++.dg/cpp1y/auto-fn26.C [new file with mode: 0644]

index 3af9ee36e1a6e94ec16d692dbfdbc5680bf3f32c..db4228f1fa29c2cc7866a28a63846fc259e977b9 100644 (file)
@@ -1,3 +1,8 @@
+2015-04-23  David Krauss  <david_work@me.com>
+
+       PR c++/59766
+       * decl.c (grokdeclarator): Do not flag friends with deduced return.
+
 2015-03-26  Mikhail Maltsev  <maltsevm@gmail.com>
 
        PR c++/65154
index b0bbf9e4fb25c1a60e6e79d3eedc56fc01993bd3..46cd58f95b93364148f386926f28db29e8998507 100644 (file)
@@ -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 %<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 (file)
index 0000000..17f232f
--- /dev/null
@@ -0,0 +1,6 @@
+// PR c++/59766
+// { dg-do compile { target c++14 } }
+
+struct T {
+  friend auto f() { }
+};