From f0f5f5a01c1c993b067299e93fd9efd078ae0051 Mon Sep 17 00:00:00 2001 From: Arthur O'Dwyer Date: Sat, 13 Apr 2019 14:58:39 -0400 Subject: [PATCH] inplace_function: Test nothrow move from smaller-capacity object. This is a regression test ensuring that I don't accidentally break nothrow-ness of the converting move operations, as I almost did in #157. --- SG14_test/inplace_function_test.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/SG14_test/inplace_function_test.cpp b/SG14_test/inplace_function_test.cpp index 3be08814..d41ddacb 100644 --- a/SG14_test/inplace_function_test.cpp +++ b/SG14_test/inplace_function_test.cpp @@ -407,6 +407,16 @@ void test_move_construction_is_noexcept() EXPECT_EQ(1, moved); } +void test_move_construction_from_smaller_buffer_is_noexcept() +{ + using IPF32 = stdext::inplace_function; + using IPF40 = stdext::inplace_function; + static_assert(std::is_nothrow_constructible::value, ""); + static_assert(std::is_nothrow_assignable::value, ""); + static_assert(std::is_nothrow_constructible::value, ""); + static_assert(std::is_nothrow_assignable::value, ""); +} + // https://bugs.llvm.org/show_bug.cgi?id=32072 struct test_bug_32072_C; struct test_bug_32072 { @@ -512,6 +522,7 @@ void sg14_test::inplace_function_test() test_nullptr(); test_overloaded_operator_new(); test_move_construction_is_noexcept(); + test_move_construction_from_smaller_buffer_is_noexcept(); } #ifdef TEST_MAIN