Browse Source

Math: can't have nice things on MSVC.

Fuck off, weird buggy compiler.
pull/168/merge
Vladimír Vondruš 2 years ago
parent
commit
5748ef0e7a
  1. 8
      src/Magnum/Math/Test/Matrix3Test.cpp
  2. 8
      src/Magnum/Math/Test/Matrix4Test.cpp
  3. 8
      src/Magnum/Math/Test/MatrixTest.cpp
  4. 8
      src/Magnum/Math/Test/RectangularMatrixTest.cpp

8
src/Magnum/Math/Test/Matrix3Test.cpp

@ -312,12 +312,20 @@ void Matrix3Test::constructArrayRvalue() {
{4.5f, 4.0f, 7.0f},
{1.0f, 2.0f, 3.0f}}));
/* Unfortunately on MSVC (even 2022) this leads to
error C2131: expression did not evaluate to a constant
note: failure was caused by out of range index 3; allowed range is 0 <= index < 2
and similarly in other tests. Not sure where that comes from, for Vector
this all works, constructArray() above works, and the GCC 4.8 workaround
with fixed size doesn't help here. */
#ifndef CORRADE_TARGET_MSVC
constexpr Matrix3 ca{{{3.0f, 5.0f, 8.0f},
{4.5f, 4.0f, 7.0f},
{1.0f, 2.0f, 3.0f}}};
CORRADE_COMPARE(ca, (Matrix3{{3.0f, 5.0f, 8.0f},
{4.5f, 4.0f, 7.0f},
{1.0f, 2.0f, 3.0f}}));
#endif
/* See RectangularMatrixTest::constructArrayRvalue() for details */
#if 0

8
src/Magnum/Math/Test/Matrix4Test.cpp

@ -369,6 +369,13 @@ void Matrix4Test::constructArrayRvalue() {
{1.0f, 2.0f, 3.0f, -1.0f},
{7.9f, -1.0f, 8.0f, -1.5f}}));
/* Unfortunately on MSVC (even 2022) this leads to
error C2131: expression did not evaluate to a constant
note: failure was caused by out of range index 3; allowed range is 0 <= index < 2
and similarly in other tests. Not sure where that comes from, for Vector
this all works, constructArray() above works, and the GCC 4.8 workaround
with fixed size doesn't help here. */
#ifndef CORRADE_TARGET_MSVC
constexpr Matrix4 ca{{{3.0f, 5.0f, 8.0f, -3.0f},
{4.5f, 4.0f, 7.0f, 2.0f},
{1.0f, 2.0f, 3.0f, -1.0f},
@ -377,6 +384,7 @@ void Matrix4Test::constructArrayRvalue() {
{4.5f, 4.0f, 7.0f, 2.0f},
{1.0f, 2.0f, 3.0f, -1.0f},
{7.9f, -1.0f, 8.0f, -1.5f}}));
#endif
/* See RectangularMatrixTest::constructArrayRvalue() for details */
#if 0

8
src/Magnum/Math/Test/MatrixTest.cpp

@ -314,6 +314,13 @@ void MatrixTest::constructArrayRvalue() {
Vector4{1.0f, 2.0f, 3.0f, -1.0f},
Vector4{7.9f, -1.0f, 8.0f, -1.5f}}));
/* Unfortunately on MSVC (even 2022) this leads to
error C2131: expression did not evaluate to a constant
note: failure was caused by out of range index 3; allowed range is 0 <= index < 2
and similarly in other tests. Not sure where that comes from, for Vector
this all works, constructArray() above works, and the GCC 4.8 workaround
with fixed size doesn't help here. */
#ifndef CORRADE_TARGET_MSVC
constexpr Matrix4x4 ca{{{3.0f, 5.0f, 8.0f, -3.0f},
{4.5f, 4.0f, 7.0f, 2.0f},
{1.0f, 2.0f, 3.0f, -1.0f},
@ -322,6 +329,7 @@ void MatrixTest::constructArrayRvalue() {
Vector4{4.5f, 4.0f, 7.0f, 2.0f},
Vector4{1.0f, 2.0f, 3.0f, -1.0f},
Vector4{7.9f, -1.0f, 8.0f, -1.5f}}));
#endif
/* See RectangularMatrixTest::constructArrayRvalue() for details */
#if 0

8
src/Magnum/Math/Test/RectangularMatrixTest.cpp

@ -333,10 +333,18 @@ void RectangularMatrixTest::constructArrayRvalue() {
CORRADE_COMPARE(a, (Matrix2x4{Vector4{3.0f, 5.0f, 8.0f, -3.0f},
Vector4{4.5f, 4.0f, 7.0f, 2.0f}}));
/* Unfortunately on MSVC (even 2022) this leads to
error C2131: expression did not evaluate to a constant
note: failure was caused by out of range index 3; allowed range is 0 <= index < 2
and similarly in other tests. Not sure where that comes from, for Vector
this all works, constructArray() above works, and the GCC 4.8 workaround
with fixed size doesn't help here. */
#ifndef CORRADE_TARGET_MSVC
constexpr Matrix2x4 ca{{{3.0f, 5.0f, 8.0f, -3.0f},
{4.5f, 4.0f, 7.0f, 2.0f}}};
CORRADE_COMPARE(ca, (Matrix2x4{Vector4{3.0f, 5.0f, 8.0f, -3.0f},
Vector4{4.5f, 4.0f, 7.0f, 2.0f}}));
#endif
/* It should always be constructible only with exactly the matching number
of elements. As that's checked with a static_assert(), it's impossible

Loading…
Cancel
Save