Browse Source

Math: work around bug in GCC 5.1 which broke the tests.

Reported here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 .
pull/107/head
Vladimír Vondruš 11 years ago
parent
commit
1a389f7a00
  1. 13
      src/Magnum/Math/Test/ComplexTest.cpp
  2. 13
      src/Magnum/Math/Test/DualComplexTest.cpp
  3. 13
      src/Magnum/Math/Test/DualQuaternionTest.cpp
  4. 13
      src/Magnum/Math/Test/QuaternionTest.cpp
  5. 13
      src/Magnum/Math/Test/RectangularMatrixTest.cpp
  6. 13
      src/Magnum/Math/Test/VectorTest.cpp

13
src/Magnum/Math/Test/ComplexTest.cpp

@ -38,7 +38,10 @@ namespace Magnum { namespace Math {
namespace Implementation {
template<> struct ComplexConverter<Float, Cmpl> {
constexpr static Complex<Float> from(const Cmpl& other) {
#if !defined(__GNUC__) || defined(__clang__)
constexpr /* See the convert() test case */
#endif
static Complex<Float> from(const Cmpl& other) {
return {other.re, other.im};
}
@ -164,7 +167,13 @@ void ComplexTest::convert() {
constexpr Cmpl a{1.5f, -3.5f};
constexpr Complex b{1.5f, -3.5f};
constexpr Complex c(a);
/* GCC 5.1 fills the result with zeros instead of properly calling
delegated copy constructor if using constexpr. Reported here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 */
#if !defined(__GNUC__) || defined(__clang__)
constexpr
#endif
Complex c(a);
CORRADE_COMPARE(c, b);
constexpr Cmpl d(b);

13
src/Magnum/Math/Test/DualComplexTest.cpp

@ -38,7 +38,10 @@ namespace Magnum { namespace Math {
namespace Implementation {
template<> struct DualComplexConverter<Float, DualCmpl> {
constexpr static DualComplex<Float> from(const DualCmpl& other) {
#if !defined(__GNUC__) || defined(__clang__)
constexpr /* See the convert() test case */
#endif
static DualComplex<Float> from(const DualCmpl& other) {
return {{other.re, other.im}, {other.x, other.y}};
}
@ -158,7 +161,13 @@ void DualComplexTest::convert() {
constexpr DualCmpl a{1.5f, -3.5f, 7.0f, -0.5f};
constexpr DualComplex b{{1.5f, -3.5f}, {7.0f, -0.5f}};
constexpr DualComplex c{a};
/* GCC 5.1 fills the result with zeros instead of properly calling
delegated copy constructor if using constexpr. Reported here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 */
#if !defined(__GNUC__) || defined(__clang__)
constexpr
#endif
DualComplex c{a};
CORRADE_COMPARE(c, b);
constexpr DualCmpl d(b);

13
src/Magnum/Math/Test/DualQuaternionTest.cpp

@ -38,7 +38,10 @@ namespace Magnum { namespace Math {
namespace Implementation {
template<> struct DualQuaternionConverter<Float, DualQuat> {
constexpr static DualQuaternion<Float> from(const DualQuat& other) {
#if !defined(__GNUC__) || defined(__clang__)
constexpr /* See the convert() test case */
#endif
static DualQuaternion<Float> from(const DualQuat& other) {
return {{{other.re.x, other.re.y, other.re.z}, other.re.w},
{{other.du.x, other.du.y, other.du.z}, other.du.w}};
}
@ -159,7 +162,13 @@ void DualQuaternionTest::convert() {
constexpr DualQuat a{{1.5f, -3.5f, 7.0f, -0.5f}, {15.0f, 0.25f, -9.5f, 0.8f}};
constexpr DualQuaternion b{{{1.5f, -3.5f, 7.0f}, -0.5f}, {{15.0f, 0.25f, -9.5f}, 0.8f}};
constexpr DualQuaternion c{a};
/* GCC 5.1 fills the result with zeros instead of properly calling
delegated copy constructor if using constexpr. Reported here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 */
#if !defined(__GNUC__) || defined(__clang__)
constexpr
#endif
DualQuaternion c{a};
CORRADE_COMPARE(c, b);
constexpr DualQuat d(b);

13
src/Magnum/Math/Test/QuaternionTest.cpp

@ -38,7 +38,10 @@ namespace Magnum { namespace Math {
namespace Implementation {
template<> struct QuaternionConverter<Float, Quat> {
constexpr static Quaternion<Float> from(const Quat& other) {
#if !defined(__GNUC__) || defined(__clang__)
constexpr /* See the convert() test case */
#endif
static Quaternion<Float> from(const Quat& other) {
return {{other.x, other.y, other.z}, other.w};
}
@ -165,7 +168,13 @@ void QuaternionTest::convert() {
constexpr Quat a{1.5f, -3.5f, 7.0f, -0.5f};
constexpr Quaternion b{{1.5f, -3.5f, 7.0f}, -0.5f};
constexpr Quaternion c{a};
/* GCC 5.1 fills the result with zeros instead of properly calling
delegated copy constructor if using constexpr. Reported here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 */
#if !defined(__GNUC__) || defined(__clang__)
constexpr
#endif
Quaternion c{a};
CORRADE_COMPARE(c, b);
constexpr Quat d(b);

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

@ -38,7 +38,10 @@ namespace Magnum { namespace Math {
namespace Implementation {
template<> struct RectangularMatrixConverter<2, 3, Float, Mat2x3> {
constexpr static RectangularMatrix<2, 3, Float> from(const Mat2x3& other) {
#if !defined(__GNUC__) || defined(__clang__)
constexpr /* See the convert() test case */
#endif
static RectangularMatrix<2, 3, Float> from(const Mat2x3& other) {
return RectangularMatrix<2, 3, Float>(
Vector<3, Float>(other.a[0], other.a[1], other.a[2]),
Vector<3, Float>(other.a[3], other.a[4], other.a[5]));
@ -211,7 +214,13 @@ void RectangularMatrixTest::convert() {
constexpr Matrix2x3 b(Vector3(1.5f, 2.0f, -3.5f),
Vector3(2.0f, -3.1f, 0.4f));
constexpr Matrix2x3 c{a};
/* GCC 5.1 fills the result with zeros instead of properly calling
delegated copy constructor if using constexpr. Reported here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 */
#if !defined(__GNUC__) || defined(__clang__)
constexpr
#endif
Matrix2x3 c{a};
CORRADE_COMPARE(c, b);
constexpr Mat2x3 d(b);

13
src/Magnum/Math/Test/VectorTest.cpp

@ -38,7 +38,10 @@ namespace Magnum { namespace Math {
namespace Implementation {
template<> struct VectorConverter<3, Float, Vec3> {
constexpr static Vector<3, Float> from(const Vec3& other) {
#if !defined(__GNUC__) || defined(__clang__)
constexpr /* See the convert() test case */
#endif
static Vector<3, Float> from(const Vec3& other) {
return {other.x, other.y, other.z};
}
@ -224,7 +227,13 @@ void VectorTest::convert() {
constexpr Vec3 a{1.5f, 2.0f, -3.5f};
constexpr Vector3 b(1.5f, 2.0f, -3.5f);
constexpr Vector3 c{a};
/* GCC 5.1 fills the result with zeros instead of properly calling
delegated copy constructor if using constexpr. Reported here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450 */
#if !defined(__GNUC__) || defined(__clang__)
constexpr
#endif
Vector3 c{a};
CORRADE_COMPARE(c, b);
constexpr Vec3 d(b);

Loading…
Cancel
Save