diff --git a/src/Magnum/Math/Matrix3.h b/src/Magnum/Math/Matrix3.h index d39ccfc2a..1defefd43 100644 --- a/src/Magnum/Math/Matrix3.h +++ b/src/Magnum/Math/Matrix3.h @@ -162,8 +162,15 @@ template class Matrix3: public Matrix3x3 { constexpr /*implicit*/ Matrix3(IdentityInitT = IdentityInit, T value = T{1}) /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT - /* MSVC 2015 can't handle {} here */ - : Matrix3x3(IdentityInit, value) + #ifndef CORRADE_MSVC2015_COMPATIBILITY + : Matrix3x3{IdentityInit, value} + #else + /* Avoid using non-constexpr version, also MSVC 2015 can't handle + {} here */ + : Matrix3x3(Vector<3, T>{value, T(0), T(0)}, + Vector<3, T>{T(0), value, T(0)}, + Vector<3, T>{T(0), T(0), value}) + #endif #endif {} @@ -171,8 +178,15 @@ template class Matrix3: public Matrix3x3 { constexpr explicit Matrix3(ZeroInitT) /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT - /* MSVC 2015 can't handle {} here */ + #ifndef CORRADE_MSVC2015_COMPATIBILITY : Matrix3x3(ZeroInit) + #else + /* Avoid using non-constexpr version, also MSVC 2015 can't handle + {} here */ + : Matrix3x3(Vector<3, T>{T(0), T(0), T(0)}, + Vector<3, T>{T(0), T(0), T(0)}, + Vector<3, T>{T(0), T(0), T(0)}) + #endif #endif {} diff --git a/src/Magnum/Math/Matrix4.h b/src/Magnum/Math/Matrix4.h index 1734ebc31..b224beaa1 100644 --- a/src/Magnum/Math/Matrix4.h +++ b/src/Magnum/Math/Matrix4.h @@ -258,8 +258,16 @@ template class Matrix4: public Matrix4x4 { constexpr /*implicit*/ Matrix4(IdentityInitT = IdentityInit, T value = T{1}) /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT - /* MSVC 2015 can't handle {} here */ - : Matrix4x4(IdentityInit, value) + #ifndef CORRADE_MSVC2015_COMPATIBILITY + : Matrix4x4{IdentityInit, value} + #else + /* Avoid using non-constexpr version, also MSVC 2015 can't handle + {} here */ + : Matrix4x4(Vector<4, T>{value, T(0), T(0), T(0)}, + Vector<4, T>{T(0), value, T(0), T(0)}, + Vector<4, T>{T(0), T(0), value, T(0)}, + Vector<4, T>{T(0), T(0), T(0), value}) + #endif #endif {} @@ -267,8 +275,16 @@ template class Matrix4: public Matrix4x4 { constexpr explicit Matrix4(ZeroInitT) /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT - /* MSVC 2015 can't handle {} here */ + #ifndef CORRADE_MSVC2015_COMPATIBILITY : Matrix4x4(ZeroInit) + #else + /* Avoid using non-constexpr version, also MSVC 2015 can't handle + {} here */ + : Matrix4x4(Vector<4, T>{T(0), T(0), T(0), T(0)}, + Vector<4, T>{T(0), T(0), T(0), T(0)}, + Vector<4, T>{T(0), T(0), T(0), T(0)}, + Vector<4, T>{T(0), T(0), T(0), T(0)}) + #endif #endif {} diff --git a/src/Magnum/Math/Test/MatrixTest.cpp b/src/Magnum/Math/Test/MatrixTest.cpp index 3cb3f894b..264938ec4 100644 --- a/src/Magnum/Math/Test/MatrixTest.cpp +++ b/src/Magnum/Math/Test/MatrixTest.cpp @@ -126,9 +126,21 @@ void MatrixTest::construct() { } void MatrixTest::constructIdentity() { - constexpr Matrix4x4 identity; - constexpr Matrix4x4 identity2{IdentityInit}; - constexpr Matrix4x4 identity3{IdentityInit, 4.0f}; + #ifndef CORRADE_MSVC2015_COMPATIBILITY + /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ + constexpr + #endif + Matrix4x4 identity; + #ifndef CORRADE_MSVC2015_COMPATIBILITY + /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ + constexpr + #endif + Matrix4x4 identity2{IdentityInit}; + #ifndef CORRADE_MSVC2015_COMPATIBILITY + /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ + constexpr + #endif + Matrix4x4 identity3{IdentityInit, 4.0f}; Matrix4x4 identityExpected(Vector4(1.0f, 0.0f, 0.0f, 0.0f), Vector4(0.0f, 1.0f, 0.0f, 0.0f), @@ -146,7 +158,11 @@ void MatrixTest::constructIdentity() { } void MatrixTest::constructZero() { - constexpr Matrix4x4 a{ZeroInit}; + #ifndef CORRADE_MSVC2015_COMPATIBILITY + /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ + constexpr + #endif + Matrix4x4 a{ZeroInit}; CORRADE_COMPARE(a, Matrix4x4(Vector4(0.0f, 0.0f, 0.0f, 0.0f), Vector4(0.0f, 0.0f, 0.0f, 0.0f), Vector4(0.0f, 0.0f, 0.0f, 0.0f), diff --git a/src/Magnum/Math/Test/RectangularMatrixTest.cpp b/src/Magnum/Math/Test/RectangularMatrixTest.cpp index d14d24da9..372fc2d61 100644 --- a/src/Magnum/Math/Test/RectangularMatrixTest.cpp +++ b/src/Magnum/Math/Test/RectangularMatrixTest.cpp @@ -149,8 +149,16 @@ void RectangularMatrixTest::construct() { } void RectangularMatrixTest::constructDefault() { - constexpr Matrix4x3 a; - constexpr Matrix4x3 b{ZeroInit}; + #ifndef CORRADE_MSVC2015_COMPATIBILITY + /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ + constexpr + #endif + Matrix4x3 a; + #ifndef CORRADE_MSVC2015_COMPATIBILITY + /* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */ + constexpr + #endif + Matrix4x3 b{ZeroInit}; CORRADE_COMPARE(a, Matrix4x3(Vector3(0.0f, 0.0f, 0.0f), Vector3(0.0f, 0.0f, 0.0f), Vector3(0.0f, 0.0f, 0.0f),