diff options
Diffstat (limited to 'libcxx/test/std/utilities/tuple/tuple.tuple')
-rw-r--r-- | libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/default.pass.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/default.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/default.pass.cpp index 8578d7fe91d..d282c9c68a4 100644 --- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/default.pass.cpp +++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/default.pass.cpp @@ -35,6 +35,16 @@ struct ThrowingDefault { ThrowingDefault() { } }; +struct IllFormedDefault { + IllFormedDefault(int x) : value(x) {} + template <bool Pred = false> + constexpr IllFormedDefault() { + static_assert(Pred, + "The default constructor should not be instantiated"); + } + int value; +}; + int main() { { @@ -89,5 +99,12 @@ int main() assert(std::get<0>(t) == 0); assert(std::get<1>(t) == nullptr); } + { + // Check that the SFINAE on the default constructor is not evaluted when + // it isn't needed. If the default constructor is evaluted then this test + // should fail to compile. + IllFormedDefault v(0); + std::tuple<IllFormedDefault> t(v); + } #endif } |