From ef77fac6594861e0305a7c141ed775f53b69cc61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 15 Jun 2021 09:20:13 +0200 Subject: [PATCH] Animation: explicitly mark Track move construction/assignment as noexcept. Interestingly enough, GCC reported these were noexcept even without that annotation. Co-authored-by: Aaron Gokaslan --- src/Magnum/Animation/Test/TrackTest.cpp | 20 ++++++++++++++++++++ src/Magnum/Animation/Track.h | 4 ++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/Magnum/Animation/Test/TrackTest.cpp b/src/Magnum/Animation/Test/TrackTest.cpp index 5b1bc79d6..a77ed079a 100644 --- a/src/Magnum/Animation/Test/TrackTest.cpp +++ b/src/Magnum/Animation/Test/TrackTest.cpp @@ -48,6 +48,9 @@ struct TrackTest: TestSuite::Tester { void constructInitializerListInterpolationInterpolator(); void constructInitializerListInterpolationInterpolatorDefaults(); + void constructCopy(); + void constructMove(); + void convertView(); void at(); @@ -106,6 +109,9 @@ TrackTest::TrackTest() { &TrackTest::constructInitializerListInterpolationInterpolator, &TrackTest::constructInitializerListInterpolationInterpolatorDefaults, + &TrackTest::constructCopy, + &TrackTest::constructMove, + &TrackTest::convertView}); addInstancedTests({&TrackTest::at, @@ -389,6 +395,20 @@ void TrackTest::constructInitializerListInterpolationInterpolatorDefaults() { CORRADE_COMPARE(a.values()[0], (Vector3{3.0f, 1.0f, 0.1f})); } +void TrackTest::constructCopy() { + CORRADE_VERIFY(!std::is_copy_constructible>::value); + CORRADE_VERIFY(!std::is_copy_assignable>::value); +} + +void TrackTest::constructMove() { + /* The move is defaulted, so verify just the right attributes */ + + CORRADE_VERIFY(std::is_nothrow_move_constructible>::value); + CORRADE_VERIFY(std::is_nothrow_move_assignable>::value); + CORRADE_VERIFY(std::is_nothrow_move_constructible>::value); + CORRADE_VERIFY(std::is_nothrow_move_assignable>::value); +} + void TrackTest::convertView() { Track a{ {{1.0f, {3.0f, 1.0f, 0.1f}}, diff --git a/src/Magnum/Animation/Track.h b/src/Magnum/Animation/Track.h index 25b1ed463..3b2d9d146 100644 --- a/src/Magnum/Animation/Track.h +++ b/src/Magnum/Animation/Track.h @@ -234,13 +234,13 @@ template&) = delete; /** @brief Move constructor */ - Track(Track&&) = default; + Track(Track&&) noexcept = default; /** @brief Copying is not allowed */ Track& operator=(const Track&) = delete; /** @brief Move constructor */ - Track& operator=(Track&&) = default; + Track& operator=(Track&&) noexcept = default; /** @brief Conversion to a view */ operator TrackView() const noexcept {