From 2cdb159cbd849eccd7f1cd78d91b18cca817635a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 28 Feb 2013 17:40:04 +0100 Subject: [PATCH] GCC 4.6 compatibility: no user-defined literals. --- src/Magnum.h | 4 ++++ src/Math/Angle.h | 1 + src/Math/Test/AngleTest.cpp | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/src/Magnum.h b/src/Magnum.h index efd95f02a..1466bbde7 100644 --- a/src/Magnum.h +++ b/src/Magnum.h @@ -40,10 +40,12 @@ namespace Magnum { namespace Math { template struct Constants; + #ifndef CORRADE_GCC46_COMPATIBILITY constexpr Rad operator "" _rad(long double); constexpr Rad operator "" _radf(long double); constexpr Deg operator "" _deg(long double); constexpr Deg operator "" _degf(long double); + #endif } /* Bring debugging facility from Corrade::Utility namespace */ @@ -240,11 +242,13 @@ typedef Math::Geometry::Rectangle Rectangled; /*@}*/ #endif +#ifndef CORRADE_GCC46_COMPATIBILITY /* Using angle literals from Math namespace */ using Math::operator "" _deg; using Math::operator "" _degf; using Math::operator "" _rad; using Math::operator "" _radf; +#endif /** @todoc Remove `ifndef` when Doxygen is sane again */ #ifndef DOXYGEN_GENERATING_OUTPUT diff --git a/src/Math/Angle.h b/src/Math/Angle.h index cc6d4489a..6ba1be5d4 100644 --- a/src/Math/Angle.h +++ b/src/Math/Angle.h @@ -20,6 +20,7 @@ */ #include +#include #include "Math/Constants.h" #include "Math/Math.h" diff --git a/src/Math/Test/AngleTest.cpp b/src/Math/Test/AngleTest.cpp index 7ac2f7e6b..5a2817893 100644 --- a/src/Math/Test/AngleTest.cpp +++ b/src/Math/Test/AngleTest.cpp @@ -73,6 +73,7 @@ void AngleTest::construct() { } void AngleTest::literals() { + #ifndef CORRADE_GCC46_COMPATIBILITY constexpr auto a = 25.0_deg; constexpr auto b = 25.0_degf; CORRADE_VERIFY((std::is_same::value)); @@ -86,6 +87,9 @@ void AngleTest::literals() { CORRADE_VERIFY((std::is_same::value)); CORRADE_COMPARE(Double(m), 3.14); CORRADE_COMPARE(Float(n), 3.14f); + #else + CORRADE_SKIP("User-defined literals are not available on GCC < 4.7."); + #endif } void AngleTest::conversion() {