Browse Source

Math: remove GCC constexpr workaround from the tests.

pull/190/head
Vladimír Vondruš 10 years ago
parent
commit
3cedefe14b
  1. 15
      src/Magnum/Math/Test/ComplexTest.cpp
  2. 15
      src/Magnum/Math/Test/DualComplexTest.cpp
  3. 15
      src/Magnum/Math/Test/DualQuaternionTest.cpp
  4. 15
      src/Magnum/Math/Test/QuaternionTest.cpp
  5. 40
      src/Magnum/Math/Test/RangeTest.cpp
  6. 15
      src/Magnum/Math/Test/RectangularMatrixTest.cpp
  7. 15
      src/Magnum/Math/Test/VectorTest.cpp

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

@ -38,10 +38,7 @@ namespace Magnum { namespace Math {
namespace Implementation {
template<> struct ComplexConverter<Float, Cmpl> {
#if !defined(__GNUC__) || defined(__clang__)
constexpr /* See the convert() test case */
#endif
static Complex<Float> from(const Cmpl& other) {
constexpr static Complex<Float> from(const Cmpl& other) {
return {other.re, other.im};
}
@ -231,13 +228,9 @@ void ComplexTest::convert() {
constexpr Cmpl a{1.5f, -3.5f};
constexpr Complex b{1.5f, -3.5f};
/* 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);
/* GCC 5.1 had a bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450
Hopefully this does not reappear. */
constexpr Complex c(a);
CORRADE_COMPARE(c, b);
constexpr Cmpl d(b);

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

@ -38,10 +38,7 @@ namespace Magnum { namespace Math {
namespace Implementation {
template<> struct DualComplexConverter<Float, DualCmpl> {
#if !defined(__GNUC__) || defined(__clang__)
constexpr /* See the convert() test case */
#endif
static DualComplex<Float> from(const DualCmpl& other) {
constexpr static DualComplex<Float> from(const DualCmpl& other) {
return {{other.re, other.im}, {other.x, other.y}};
}
@ -231,13 +228,9 @@ 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}};
/* 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};
/* GCC 5.1 had a bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450
Hopefully this does not reappear. */
constexpr DualComplex c{a};
CORRADE_COMPARE(c, b);
constexpr DualCmpl d(b);

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

@ -38,10 +38,7 @@ namespace Magnum { namespace Math {
namespace Implementation {
template<> struct DualQuaternionConverter<Float, DualQuat> {
#if !defined(__GNUC__) || defined(__clang__)
constexpr /* See the convert() test case */
#endif
static DualQuaternion<Float> from(const DualQuat& other) {
constexpr 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}};
}
@ -253,13 +250,9 @@ 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}};
/* 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};
/* GCC 5.1 had a bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450
Hopefully this does not reappear. */
constexpr DualQuaternion c{a};
CORRADE_COMPARE(c, b);
constexpr DualQuat d(b);

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

@ -39,10 +39,7 @@ namespace Magnum { namespace Math {
namespace Implementation {
template<> struct QuaternionConverter<Float, Quat> {
#if !defined(__GNUC__) || defined(__clang__)
constexpr /* See the convert() test case */
#endif
static Quaternion<Float> from(const Quat& other) {
constexpr static Quaternion<Float> from(const Quat& other) {
return {{other.x, other.y, other.z}, other.w};
}
@ -233,13 +230,9 @@ 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};
/* 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};
/* GCC 5.1 had a bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450
Hopefully this does not reappear. */
constexpr Quaternion c{a};
CORRADE_COMPARE(c, b);
constexpr Quat d(b);

40
src/Magnum/Math/Test/RangeTest.cpp

@ -46,10 +46,7 @@ namespace Magnum { namespace Math {
namespace Implementation {
template<> struct RangeConverter<1, Float, Dim> {
#if !defined(__GNUC__) || defined(__clang__)
constexpr /* See the convert() test case */
#endif
static Range<1, Float> from(const Dim& other) {
constexpr static Range<1, Float> from(const Dim& other) {
/* Doing it this way to preserve constexpr */
return {other.offset, other.offset + other.size};
}
@ -62,10 +59,7 @@ template<> struct RangeConverter<1, Float, Dim> {
};
template<> struct RangeConverter<2, Float, Rect> {
#if !defined(__GNUC__) || defined(__clang__)
constexpr /* See the convert() test case */
#endif
static Range<2, Float> from(const Rect& other) {
constexpr static Range<2, Float> from(const Rect& other) {
/* Doing it this way to preserve constexpr */
return {{other.x, other.y}, {other.x + other.w, other.y + other.h}};
}
@ -79,10 +73,7 @@ template<> struct RangeConverter<2, Float, Rect> {
};
template<> struct RangeConverter<3, Float, Box> {
#if !defined(__GNUC__) || defined(__clang__)
constexpr /* See the convert() test case */
#endif
static Range<3, Float> from(const Box& other) {
constexpr static Range<3, Float> from(const Box& other) {
return {{other.x, other.y, other.z},
/* Doing it this way to preserve constexpr */
{other.x + other.w,
@ -296,25 +287,12 @@ void RangeTest::convert() {
constexpr Range2D e{{1.5f, -2.0f}, {5.0f, -1.5f}};
constexpr Range3D f{{1.5f, -2.0f, -0.5f}, {5.0f, -1.5f, 9.0f}};
/* 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
Range<2, Float> g{b};
#if !defined(__GNUC__) || defined(__clang__)
constexpr
#endif
Range1D h{a};
#if !defined(__GNUC__) || defined(__clang__)
constexpr
#endif
Range2D i{b};
#if !defined(__GNUC__) || defined(__clang__)
constexpr
#endif
Range3D j{c};
/* GCC 5.1 had a bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450
Hopefully this does not reappear. */
constexpr Range<2, Float> g{b};
constexpr Range1D h{a};
constexpr Range2D i{b};
constexpr Range3D j{c};
CORRADE_COMPARE(g, e);
CORRADE_COMPARE(h, d);
CORRADE_COMPARE(i, e);

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

@ -38,10 +38,7 @@ namespace Magnum { namespace Math {
namespace Implementation {
template<> struct RectangularMatrixConverter<2, 3, Float, Mat2x3> {
#if !defined(__GNUC__) || defined(__clang__)
constexpr /* See the convert() test case */
#endif
static RectangularMatrix<2, 3, Float> from(const Mat2x3& other) {
constexpr 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]));
@ -255,13 +252,9 @@ void RectangularMatrixTest::convert() {
constexpr Matrix2x3 b(Vector3(1.5f, 2.0f, -3.5f),
Vector3(2.0f, -3.1f, 0.4f));
/* 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};
/* GCC 5.1 had a bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450
Hopefully this does not reappear. */
constexpr Matrix2x3 c{a};
CORRADE_COMPARE(c, b);
constexpr Mat2x3 d(b);

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

@ -38,10 +38,7 @@ namespace Magnum { namespace Math {
namespace Implementation {
template<> struct VectorConverter<3, Float, Vec3> {
#if !defined(__GNUC__) || defined(__clang__)
constexpr /* See the convert() test case */
#endif
static Vector<3, Float> from(const Vec3& other) {
constexpr static Vector<3, Float> from(const Vec3& other) {
return {other.x, other.y, other.z};
}
@ -267,13 +264,9 @@ void VectorTest::convert() {
constexpr Vec3 a{1.5f, 2.0f, -3.5f};
constexpr Vector3 b(1.5f, 2.0f, -3.5f);
/* 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};
/* GCC 5.1 had a bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66450
Hopefully this does not reappear. */
constexpr Vector3 c{a};
CORRADE_COMPARE(c, b);
constexpr Vec3 d(b);

Loading…
Cancel
Save