]> gcc.gnu.org Git - gcc.git/commitdiff
c++: Add testcase for [PR81339]
authorPatrick Palka <ppalka@redhat.com>
Fri, 24 Jul 2020 18:31:36 +0000 (14:31 -0400)
committerPatrick Palka <ppalka@redhat.com>
Fri, 24 Jul 2020 18:39:10 +0000 (14:39 -0400)
We correctly reject this testcase since r11-434, i.e. since the fix for
PR c++/57943.

gcc/testsuite/ChangeLog:

PR c++/81339
* g++.dg/cpp0x/decltype78.C: New test.

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

diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype78.C b/gcc/testsuite/g++.dg/cpp0x/decltype78.C
new file mode 100644 (file)
index 0000000..6f4e5b4
--- /dev/null
@@ -0,0 +1,24 @@
+// PR c++/81339
+// { dg-do compile { target c++11 } }
+
+struct true_type { static const bool value = true; };
+struct false_type { static const bool value = false; };
+
+template <typename T>
+struct IsDefaultConstructibleT
+{
+    // using T here (instead of U) should be an error
+    template <typename U, typename = decltype(T())> // { dg-error "deleted" }
+      static true_type test(void*);
+
+    template <typename U>
+      static false_type test(...);
+
+    static constexpr bool value = decltype(test<T>(nullptr))::value;
+};
+
+struct S {
+  S() = delete;
+};
+
+static_assert( IsDefaultConstructibleT<S>::value, "" ); // { dg-error "assertion failed" }
This page took 0.071158 seconds and 5 git commands to generate.