diff mbox series

[committed] c++: Add testcase for already-fixed PR [PR70642]

Message ID 20200513134225.585425-1-ppalka@redhat.com
State New
Headers show
Series [committed] c++: Add testcase for already-fixed PR [PR70642] | expand

Commit Message

Patrick Palka May 13, 2020, 1:42 p.m. UTC
We correctly reject the testcase in this PR ever since commit r9-7046.

gcc/testsuite/ChangeLog:

	PR c++/70642
	* g++.dg/cpp0x/alias-decl-70.C: New test.
---
 gcc/testsuite/ChangeLog                    |  5 +++++
 gcc/testsuite/g++.dg/cpp0x/alias-decl-70.C | 23 ++++++++++++++++++++++
 2 files changed, 28 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-70.C
diff mbox series

Patch

diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 22adacb264c..4f602ed6f31 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@ 
+2020-05-13  Patrick Palka  <ppalka@redhat.com>
+
+	PR c++/70642
+	* g++.dg/cpp0x/alias-decl-70.C: New test.
+
 2020-05-13  Jakub Jelinek  <jakub@redhat.com>
 
 	PR debug/95080
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-70.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-70.C
new file mode 100644
index 00000000000..28d9279e8a4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-70.C
@@ -0,0 +1,23 @@ 
+// PR c++/70642
+// { dg-do compile { target c++11 } }
+
+template<bool, class> struct enable_if {};
+template<class T> struct enable_if<true, T> { using type = T; };
+
+template <typename X>
+struct foo
+{
+     template <typename R>
+     using meow = typename enable_if<sizeof(X) == 0, R>::type; // { dg-error "no type named .type." }
+
+     template <typename R = int>       // 1
+     meow<R> bar () = delete;
+
+     int bar ()
+     {
+        meow<int> i;          // 2
+        return 0;             // 3
+     }
+};
+
+int j = foo<long>().bar();