From 0db3a183ae12e1287dda3da203b9d092bab6c1b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 31 Mar 2013 20:30:36 +0200 Subject: [PATCH] GCC 4.4 compatibility: issues with lack of explicit conversion operators. --- src/Math/Test/ComplexTest.cpp | 7 ++++++- src/Math/Test/FunctionsTest.cpp | 16 ++++++++-------- src/Math/Test/UnitTest.cpp | 7 ++++++- src/Math/Test/Vector2Test.cpp | 7 ++++++- src/Math/Test/Vector3Test.cpp | 7 ++++++- src/Math/Test/Vector4Test.cpp | 7 ++++++- src/Math/Test/VectorTest.cpp | 7 ++++++- 7 files changed, 44 insertions(+), 14 deletions(-) diff --git a/src/Math/Test/ComplexTest.cpp b/src/Math/Test/ComplexTest.cpp index 1942d1a5d..ca5af8f47 100644 --- a/src/Math/Test/ComplexTest.cpp +++ b/src/Math/Test/ComplexTest.cpp @@ -129,7 +129,12 @@ void ComplexTest::constructFromVector() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); - CORRADE_VERIFY(!(std::is_convertible::value)); + { + #ifdef CORRADE_GCC44_COMPATIBILITY + CORRADE_EXPECT_FAIL("GCC 4.4 doesn't have explicit conversion operators"); + #endif + CORRADE_VERIFY(!(std::is_convertible::value)); + } } void ComplexTest::constructCopy() { diff --git a/src/Math/Test/FunctionsTest.cpp b/src/Math/Test/FunctionsTest.cpp index 898df5ef8..e7d2770d5 100644 --- a/src/Math/Test/FunctionsTest.cpp +++ b/src/Math/Test/FunctionsTest.cpp @@ -300,17 +300,17 @@ void FunctionsTest::trigonometric() { void FunctionsTest::trigonometricWithBase() { /* Verify that the functions can be called with Unit and Unit */ - CORRADE_VERIFY((std::is_same>::value)); - CORRADE_VERIFY((std::is_same>::value)); + CORRADE_VERIFY((std::is_same>::value)); + CORRADE_VERIFY((std::is_same>::value)); - CORRADE_COMPARE(Math::sin(2*Deg(15.0f)), 0.5f); - CORRADE_COMPARE(Math::sin(2*Rad(Constants::pi()/12)), 0.5f); + CORRADE_COMPARE(Math::sin(Deg(15.0f)+Deg(15.0f)), 0.5f); + CORRADE_COMPARE(Math::sin(Rad(Constants::pi()/12)+Rad(Constants::pi()/12)), 0.5f); - CORRADE_COMPARE(Math::cos(2*Deg(30.0f)), 0.5f); - CORRADE_COMPARE(Math::cos(2*Rad(Constants::pi()/6)), 0.5f); + CORRADE_COMPARE(Math::cos(Deg(30.0f)+Deg(30.0f)), 0.5f); + CORRADE_COMPARE(Math::cos(Rad(Constants::pi()/6)+Rad(Constants::pi()/6)), 0.5f); - CORRADE_COMPARE(Math::tan(2*Deg(22.5f)), 1.0f); - CORRADE_COMPARE(Math::tan(2*Rad(Constants::pi()/8)), 1.0f); + CORRADE_COMPARE(Math::tan(Deg(22.5f)+Deg(22.5f)), 1.0f); + CORRADE_COMPARE(Math::tan(Rad(Constants::pi()/8)+Rad(Constants::pi()/8)), 1.0f); } }}} diff --git a/src/Math/Test/UnitTest.cpp b/src/Math/Test/UnitTest.cpp index 3de4a1db9..9adf26e1f 100644 --- a/src/Math/Test/UnitTest.cpp +++ b/src/Math/Test/UnitTest.cpp @@ -67,7 +67,12 @@ void UnitTest::construct() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); - CORRADE_VERIFY(!(std::is_convertible::value)); + { + #ifdef CORRADE_GCC44_COMPATIBILITY + CORRADE_EXPECT_FAIL("GCC 4.4 doesn't have explicit conversion operators"); + #endif + CORRADE_VERIFY(!(std::is_convertible::value)); + } } void UnitTest::constructDefault() { diff --git a/src/Math/Test/Vector2Test.cpp b/src/Math/Test/Vector2Test.cpp index ec05fab05..4eccd3802 100644 --- a/src/Math/Test/Vector2Test.cpp +++ b/src/Math/Test/Vector2Test.cpp @@ -147,7 +147,12 @@ void Vector2Test::convert() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); - CORRADE_VERIFY(!(std::is_convertible::value)); + { + #ifdef CORRADE_GCC44_COMPATIBILITY + CORRADE_EXPECT_FAIL("GCC 4.4 doesn't have explicit conversion operators"); + #endif + CORRADE_VERIFY(!(std::is_convertible::value)); + } } void Vector2Test::access() { diff --git a/src/Math/Test/Vector3Test.cpp b/src/Math/Test/Vector3Test.cpp index 649cd1851..439fdecb9 100644 --- a/src/Math/Test/Vector3Test.cpp +++ b/src/Math/Test/Vector3Test.cpp @@ -161,7 +161,12 @@ void Vector3Test::convert() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); - CORRADE_VERIFY(!(std::is_convertible::value)); + { + #ifdef CORRADE_GCC44_COMPATIBILITY + CORRADE_EXPECT_FAIL("GCC 4.4 doesn't have explicit conversion operators"); + #endif + CORRADE_VERIFY(!(std::is_convertible::value)); + } } void Vector3Test::access() { diff --git a/src/Math/Test/Vector4Test.cpp b/src/Math/Test/Vector4Test.cpp index 447215890..98617f9c1 100644 --- a/src/Math/Test/Vector4Test.cpp +++ b/src/Math/Test/Vector4Test.cpp @@ -159,7 +159,12 @@ void Vector4Test::convert() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); - CORRADE_VERIFY(!(std::is_convertible::value)); + { + #ifdef CORRADE_GCC44_COMPATIBILITY + CORRADE_EXPECT_FAIL("GCC 4.4 doesn't have explicit conversion operators"); + #endif + CORRADE_VERIFY(!(std::is_convertible::value)); + } } void Vector4Test::access() { diff --git a/src/Math/Test/VectorTest.cpp b/src/Math/Test/VectorTest.cpp index 7c93976b6..839450e8b 100644 --- a/src/Math/Test/VectorTest.cpp +++ b/src/Math/Test/VectorTest.cpp @@ -223,7 +223,12 @@ void VectorTest::convert() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); - CORRADE_VERIFY(!(std::is_convertible::value)); + { + #ifdef CORRADE_GCC44_COMPATIBILITY + CORRADE_EXPECT_FAIL("GCC 4.4 doesn't have explicit conversion operators"); + #endif + CORRADE_VERIFY(!(std::is_convertible::value)); + } } void VectorTest::data() {