c++: Add testcase for [PR79504]
authorPatrick Palka <ppalka@redhat.com>
Sun, 26 Jul 2020 17:37:26 +0000 (13:37 -0400)
committerPatrick Palka <ppalka@redhat.com>
Sun, 26 Jul 2020 17:51:02 +0000 (13:51 -0400)
We successfully compile this testcase ever since r8-5270.

gcc/testsuite/ChangeLog:

PR c++/79504
* g++.dg/cpp0x/decltype79.C: New test.

gcc/testsuite/g++.dg/cpp0x/decltype79.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype79.C b/gcc/testsuite/g++.dg/cpp0x/decltype79.C
new file mode 100644 (file)
index 0000000..50c292a
--- /dev/null
@@ -0,0 +1,19 @@
+// PR c++/79504
+// { dg-do compile { target c++11 } }
+
+struct A
+{
+  void f () & {}
+
+  template <typename ...Args>
+    auto f (Args &&... args) && -> decltype (this->f (args...))
+    {
+      return this->f (args...);
+    }
+};
+
+int main (){
+  A p;
+  p.f ();
+  A{}.f();
+}