Browse Source

GCC 4.5 compatibility: constexpr-related issues.

Vladimír Vondruš 13 years ago
parent
commit
e3a540b33d
  1. 8
      src/Math/Test/Vector2Test.cpp
  2. 8
      src/Math/Test/Vector3Test.cpp
  3. 8
      src/Math/Test/Vector4Test.cpp
  4. 28
      src/Test/ColorTest.cpp

8
src/Math/Test/Vector2Test.cpp

@ -216,7 +216,13 @@ void Vector2Test::aspectRatio() {
void Vector2Test::swizzleType() { void Vector2Test::swizzleType() {
constexpr Vector<4, Int> orig; constexpr Vector<4, Int> orig;
constexpr auto a = swizzle<'y', 'a'>(orig);
#ifndef CORRADE_GCC45_COMPATIBILITY
constexpr
#else
const
#endif
auto a = swizzle<'y', 'a'>(orig);
CORRADE_VERIFY((std::is_same<decltype(a), const Vector2i>::value)); CORRADE_VERIFY((std::is_same<decltype(a), const Vector2i>::value));
} }

8
src/Math/Test/Vector3Test.cpp

@ -236,7 +236,13 @@ void Vector3Test::twoComponent() {
void Vector3Test::swizzleType() { void Vector3Test::swizzleType() {
constexpr Vector<4, Int> orig; constexpr Vector<4, Int> orig;
constexpr auto b = swizzle<'y', 'z', 'a'>(orig);
#ifndef CORRADE_GCC45_COMPATIBILITY
constexpr
#else
const
#endif
auto b = swizzle<'y', 'z', 'a'>(orig);
CORRADE_VERIFY((std::is_same<decltype(b), const Vector3i>::value)); CORRADE_VERIFY((std::is_same<decltype(b), const Vector3i>::value));
} }

8
src/Math/Test/Vector4Test.cpp

@ -228,7 +228,13 @@ void Vector4Test::twoComponent() {
void Vector4Test::swizzleType() { void Vector4Test::swizzleType() {
constexpr Vector4i orig; constexpr Vector4i orig;
constexpr auto c = swizzle<'y', 'a', 'y', 'x'>(orig);
#ifndef CORRADE_GCC45_COMPATIBILITY
constexpr
#else
const
#endif
auto c = swizzle<'y', 'a', 'y', 'x'>(orig);
CORRADE_VERIFY((std::is_same<decltype(c), const Vector4i>::value)); CORRADE_VERIFY((std::is_same<decltype(c), const Vector4i>::value));
} }

28
src/Test/ColorTest.cpp

@ -143,16 +143,36 @@ void ColorTest::swizzleType() {
constexpr Color3 origColor3; constexpr Color3 origColor3;
constexpr BasicColor4<UnsignedByte> origColor4; constexpr BasicColor4<UnsignedByte> origColor4;
constexpr auto a = Math::swizzle<'y', 'z', 'r'>(origColor3); #ifndef CORRADE_GCC45_COMPATIBILITY
constexpr
#else
const
#endif
auto a = Math::swizzle<'y', 'z', 'r'>(origColor3);
CORRADE_VERIFY((std::is_same<decltype(a), const Color3>::value)); CORRADE_VERIFY((std::is_same<decltype(a), const Color3>::value));
constexpr auto b = Math::swizzle<'y', 'z', 'a'>(origColor4); #ifndef CORRADE_GCC45_COMPATIBILITY
constexpr
#else
const
#endif
auto b = Math::swizzle<'y', 'z', 'a'>(origColor4);
CORRADE_VERIFY((std::is_same<decltype(b), const BasicColor3<UnsignedByte>>::value)); CORRADE_VERIFY((std::is_same<decltype(b), const BasicColor3<UnsignedByte>>::value));
constexpr auto c = Math::swizzle<'y', 'z', 'y', 'x'>(origColor3); #ifndef CORRADE_GCC45_COMPATIBILITY
constexpr
#else
const
#endif
auto c = Math::swizzle<'y', 'z', 'y', 'x'>(origColor3);
CORRADE_VERIFY((std::is_same<decltype(c), const Color4>::value)); CORRADE_VERIFY((std::is_same<decltype(c), const Color4>::value));
constexpr auto d = Math::swizzle<'y', 'a', 'y', 'x'>(origColor4); #ifndef CORRADE_GCC45_COMPATIBILITY
constexpr
#else
const
#endif
auto d = Math::swizzle<'y', 'a', 'y', 'x'>(origColor4);
CORRADE_VERIFY((std::is_same<decltype(d), const BasicColor4<UnsignedByte>>::value)); CORRADE_VERIFY((std::is_same<decltype(d), const BasicColor4<UnsignedByte>>::value));
} }

Loading…
Cancel
Save