re PR c++/60943 ([C++14] Return type deduction interferes with ref-qualifiers)
authorNathan Sidwell <nathan@acm.org>
Thu, 21 May 2015 20:50:45 +0000 (20:50 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Thu, 21 May 2015 20:50:45 +0000 (20:50 +0000)
cp/
PR c++/60943
* decl2.c (change_return_type): Propagate FUNCTION_REF_QUALIFIED.

testsuite/
* g++.dg/cpp1y/pr60943.C: New.

From-SVN: r223502

gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1y/pr60943.C [new file with mode: 0644]

index 6460314253142b0c3fbb99566d3c7000d20252fd..f9ede2dcf62f4164fd5a29be6879bf2d7f3cf219 100644 (file)
@@ -1,3 +1,8 @@
+2015-05-21  Nathan Sidwell  <nathan@acm.org>
+
+       PR c++/60943
+       * decl2.c (change_return_type): Propagate FUNCTION_REF_QUALIFIED.
+
 2015-05-21  Marek Polacek  <polacek@redhat.com>
 
        * typeck.c (warn_args_num): Don't print "declare here" for builtins.
@@ -14,7 +19,7 @@
        (build_op_delete_call): Warn about size_t placement delete with
        -Wc++14-compat.
 
-2015-05-19  Nathan sidwell  <nathan@acm.org>
+2015-05-19  Nathan Sidwell  <nathan@acm.org>
 
        PR c++/65954
        * typeck.c (finish_class_member_access_expr): Diagnose failed
index 27bacabb8472033d09cc45665adc75c80a4b1746..f1b3d0cbc6a8824fdb78c62235107a5bced0e40c 100644 (file)
@@ -195,6 +195,8 @@ change_return_type (tree new_ret, tree fntype)
   else
     newtype = build_method_type_directly
       (class_of_this_parm (fntype), new_ret, TREE_CHAIN (args));
+  if (FUNCTION_REF_QUALIFIED (fntype))
+    newtype = build_ref_qualified_type (newtype, type_memfn_rqual (fntype));
   if (raises)
     newtype = build_exception_variant (newtype, raises);
   if (attrs)
index e5083f65bf13a8fbff96041afef45cfbdc955c8c..bd4e57e0367ed9a378133311df548e450567e0e7 100644 (file)
@@ -1,3 +1,7 @@
+2015-05-21  Nathan Sidwell  <nathan@acm.org>
+
+       * g++.dg/cpp1y/pr60943.C: New.
+                                        
 2015-05-21  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/66233
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr60943.C b/gcc/testsuite/g++.dg/cpp1y/pr60943.C
new file mode 100644 (file)
index 0000000..43857af
--- /dev/null
@@ -0,0 +1,16 @@
+// { dg-options "-std=c++14" }
+
+struct A {
+  auto f() & {}
+  auto f() && {}
+};
+
+void Foo (A &a)
+{
+  a.f();
+}
+
+void Bar (A &&a)
+{
+  a.f ();
+}