From: Patrick Palka Date: Fri, 24 Jul 2020 18:31:36 +0000 (-0400) Subject: c++: Add testcase for [PR81339] X-Git-Tag: upstream/12.2.0~14646 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=048ba9c02db7ee461abe86a37544fcd4e0cf8858;p=platform%2Fupstream%2Fgcc.git 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. --- 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 +struct IsDefaultConstructibleT +{ + // using T here (instead of U) should be an error + template // { dg-error "deleted" } + static true_type test(void*); + + template + static false_type test(...); + + static constexpr bool value = decltype(test(nullptr))::value; +}; + +struct S { + S() = delete; +}; + +static_assert( IsDefaultConstructibleT::value, "" ); // { dg-error "assertion failed" }