aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2020-07-24 14:31:36 -0400
committerPatrick Palka <ppalka@redhat.com>2020-07-24 14:39:10 -0400
commit048ba9c02db7ee461abe86a37544fcd4e0cf8858 (patch)
tree66e3a7f128daa01752baae6c094a7e5d9f7eb0ca
parent29a14a1a907947fe9e43bce62d3468559f17da97 (diff)
downloadgcc-048ba9c02db7ee461abe86a37544fcd4e0cf8858.zip
gcc-048ba9c02db7ee461abe86a37544fcd4e0cf8858.tar.gz
gcc-048ba9c02db7ee461abe86a37544fcd4e0cf8858.tar.bz2
c++: Add testcase for [PR81339]
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.
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/decltype78.C24
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype78.C b/gcc/testsuite/g++.dg/cpp0x/decltype78.C
new file mode 100644
index 0000000..6f4e5b4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/decltype78.C
@@ -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" }