[COMMITTED] c++: Add testcase for [PR81339]
Patrick Palka
ppalka@redhat.com
Fri Jul 24 18:44:00 GMT 2020
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 | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype78.C
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype78.C b/gcc/testsuite/g++.dg/cpp0x/decltype78.C
new file mode 100644
index 00000000000..6f4e5b4ad3b
--- /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" }
--
2.28.0.rc1
More information about the Gcc-patches
mailing list