From 08d51ec116efa99eadb13622c0ac0d3889809645 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 7 Oct 2018 19:15:21 +0200 Subject: [PATCH] Math: oh, MSVC 2015 constexpr fun is here again. --- src/Magnum/Math/Test/BezierTest.cpp | 5 ++++- src/Magnum/Math/Test/DualQuaternionTest.cpp | 5 ++++- src/Magnum/Math/Test/QuaternionTest.cpp | 5 ++++- src/Magnum/Math/Test/VectorTest.cpp | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Magnum/Math/Test/BezierTest.cpp b/src/Magnum/Math/Test/BezierTest.cpp index dd7a4261e..f5f25ba08 100644 --- a/src/Magnum/Math/Test/BezierTest.cpp +++ b/src/Magnum/Math/Test/BezierTest.cpp @@ -222,7 +222,10 @@ void BezierTest::data() { Vector2 c = b[2]; CORRADE_COMPARE(c, (Vector2{0.0f, -1.2f})); - constexpr Vector2 d = *b.data(); + #ifndef CORRADE_MSVC2015_COMPATIBILITY /* Why? */ + constexpr + #endif + Vector2 d = *b.data(); Vector2 e = a.data()[2]; CORRADE_COMPARE(d, (Vector2{3.5f, 0.1f})); CORRADE_COMPARE(e, (Vector2{0.7f, 20.3f})); diff --git a/src/Magnum/Math/Test/DualQuaternionTest.cpp b/src/Magnum/Math/Test/DualQuaternionTest.cpp index cac529bd6..041b83b54 100644 --- a/src/Magnum/Math/Test/DualQuaternionTest.cpp +++ b/src/Magnum/Math/Test/DualQuaternionTest.cpp @@ -286,7 +286,10 @@ void DualQuaternionTest::data() { DualQuaternion a{{{1.0f, 2.0f, 3.0f}, -4.0f}, {{0.5f, -3.1f, 3.3f}, 2.0f}}; - constexpr Float d = *ca.data(); + #ifndef CORRADE_MSVC2015_COMPATIBILITY /* Apparently dereferencing a pointer is verboten */ + constexpr + #endif + Float d = *ca.data(); Float e = a.data()[7]; CORRADE_COMPARE(d, 1.0f); CORRADE_COMPARE(e, 2.0f); diff --git a/src/Magnum/Math/Test/QuaternionTest.cpp b/src/Magnum/Math/Test/QuaternionTest.cpp index 390c0977e..879f14521 100644 --- a/src/Magnum/Math/Test/QuaternionTest.cpp +++ b/src/Magnum/Math/Test/QuaternionTest.cpp @@ -284,7 +284,10 @@ void QuaternionTest::data() { a.scalar() = 1.1f; CORRADE_COMPARE(a, (Quaternion{{1.0f, 4.3f, 3.0f}, 1.1f})); - constexpr Float b = *ca.data(); + #ifndef CORRADE_MSVC2015_COMPATIBILITY /* Apparently dereferencing a pointer is verboten */ + constexpr + #endif + Float b = *ca.data(); Float c = a.data()[3]; CORRADE_COMPARE(b, 1.0f); CORRADE_COMPARE(c, 1.1f); diff --git a/src/Magnum/Math/Test/VectorTest.cpp b/src/Magnum/Math/Test/VectorTest.cpp index d93e05147..53a106bcc 100644 --- a/src/Magnum/Math/Test/VectorTest.cpp +++ b/src/Magnum/Math/Test/VectorTest.cpp @@ -309,7 +309,7 @@ void VectorTest::data() { /* Pointer chasings, i.e. *(b.data()[3]), are not possible */ constexpr Vector4 a(1.0f, 2.0f, -3.0f, 4.5f); constexpr Float f = a[3]; - #ifndef CORRADE_MSVC2015_COMPATIBILITY /* Apparently dereferencing pointer is verboten */ + #ifndef CORRADE_MSVC2015_COMPATIBILITY /* Apparently dereferencing a pointer is verboten */ constexpr #endif Float g = *a.data();