[COMMITTED] c++: Add testcase for [PR79504]

Message ID 20200726175553.460672-1-ppalka@redhat.com
State New
Headers show
Series
  • [COMMITTED] c++: Add testcase for [PR79504]
Related show

Commit Message

Jakub Jelinek via Gcc-patches July 26, 2020, 5:55 p.m.
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 | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype79.C

-- 
2.28.0.rc1

Patch

diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype79.C b/gcc/testsuite/g++.dg/cpp0x/decltype79.C
new file mode 100644
index 00000000000..50c292a1958
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/decltype79.C
@@ -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();
+}