Skip to content

Commit

Permalink
inplace_function: Test nothrow move from smaller-capacity object.
Browse files Browse the repository at this point in the history
This is a regression test ensuring that I don't accidentally break
nothrow-ness of the converting move operations, as I almost did in WG21-SG14#157.
  • Loading branch information
Quuxplusone committed Apr 13, 2019
1 parent 0865d64 commit f0f5f5a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions SG14_test/inplace_function_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<void(int), 32>;
using IPF40 = stdext::inplace_function<void(int), 40>;
static_assert(std::is_nothrow_constructible<IPF32, IPF32&&>::value, "");
static_assert(std::is_nothrow_assignable<IPF32, IPF32&&>::value, "");
static_assert(std::is_nothrow_constructible<IPF40, IPF32&&>::value, "");
static_assert(std::is_nothrow_assignable<IPF40, IPF32&&>::value, "");
}

// https://bugs.llvm.org/show_bug.cgi?id=32072
struct test_bug_32072_C;
struct test_bug_32072 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f0f5f5a

Please sign in to comment.