diff --git a/src/Magnum/Math/Angle.h b/src/Magnum/Math/Angle.h index 1a16ba6bb..2a3c793e3 100644 --- a/src/Magnum/Math/Angle.h +++ b/src/Magnum/Math/Angle.h @@ -136,7 +136,7 @@ template class Deg: public Unit { * @f] * @m_keyword{degrees(),GLSL degrees(),} */ - constexpr /*implicit*/ Deg(Unit value); + constexpr /*implicit*/ Deg(Unit value) noexcept; }; /* Unlike STL, where there's e.g. std::literals::string_literals with both @@ -225,7 +225,7 @@ template class Rad: public Unit { * @f] * @m_keyword{radians(),GLSL radians(),} */ - constexpr /*implicit*/ Rad(Unit value); + constexpr /*implicit*/ Rad(Unit value) noexcept; }; /* Unlike STL, where there's e.g. std::literals::string_literals with both @@ -266,8 +266,8 @@ constexpr Rad operator "" _radf(long double value) { return Rad(Fl }} -template constexpr Deg::Deg(Unit value): Unit(T(180)*T(value)/Math::Constants::pi()) {} -template constexpr Rad::Rad(Unit value): Unit(T(value)*Math::Constants::pi()/T(180)) {} +template constexpr Deg::Deg(Unit value) noexcept: Unit(T(180)*T(value)/Math::Constants::pi()) {} +template constexpr Rad::Rad(Unit value) noexcept: Unit(T(value)*Math::Constants::pi()/T(180)) {} #ifndef CORRADE_SINGLES_NO_DEBUG /** @debugoperator{Rad} */ diff --git a/src/Magnum/Math/Test/AngleTest.cpp b/src/Magnum/Math/Test/AngleTest.cpp index 5d4c9f181..f1764bb7b 100644 --- a/src/Magnum/Math/Test/AngleTest.cpp +++ b/src/Magnum/Math/Test/AngleTest.cpp @@ -334,6 +334,9 @@ void AngleTest::conversion() { constexpr Rad b = 90.0_degf; CORRADE_COMPARE(Float(b), 1.57079633f); + + CORRADE_VERIFY(std::is_nothrow_constructible::value); + CORRADE_VERIFY(std::is_nothrow_constructible::value); } void AngleTest::debugDeg() {