Browse Source

Fix compilation errors in GCC 4.6 and 4.8

rdb 8 years ago
parent
commit
88e963b936
1 changed files with 7 additions and 6 deletions
  1. 7 6
      dtool/src/dtoolbase/dtoolbase_cc.h

+ 7 - 6
dtool/src/dtoolbase/dtoolbase_cc.h

@@ -178,12 +178,6 @@ template<class T> typename remove_reference<T>::type &&move(T &&t) {
 #  endif
 #  endif
 #elif defined(__GNUC__) && (__cplusplus >= 201103L) // GCC
 #elif defined(__GNUC__) && (__cplusplus >= 201103L) // GCC
 
 
-// GCC defines several macros which we can query.  List of all supported
-// builtin macros: https://gcc.gnu.org/projects/cxx-status.html
-#  if __cpp_constexpr >= 200704
-#    define CONSTEXPR constexpr
-#  endif
-
 // Starting at GCC 4.4
 // Starting at GCC 4.4
 #  if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
 #  if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
 #  define DEFAULT_CTOR = default
 #  define DEFAULT_CTOR = default
@@ -194,6 +188,7 @@ template<class T> typename remove_reference<T>::type &&move(T &&t) {
 
 
 // Starting at GCC 4.6
 // Starting at GCC 4.6
 #  if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
 #  if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
+#    define CONSTEXPR constexpr
 #    define NOEXCEPT noexcept
 #    define NOEXCEPT noexcept
 #    define USE_MOVE_SEMANTICS
 #    define USE_MOVE_SEMANTICS
 #    define FINAL final
 #    define FINAL final
@@ -205,6 +200,12 @@ template<class T> typename remove_reference<T>::type &&move(T &&t) {
 #    define OVERRIDE override
 #    define OVERRIDE override
 #  endif
 #  endif
 
 
+// GCC defines several macros which we can query.  List of all supported
+// builtin macros: https://gcc.gnu.org/projects/cxx-status.html
+#  if !defined(CONSTEXPR) && __cpp_constexpr >= 200704
+#    define CONSTEXPR constexpr
+#  endif
+
 #elif defined(_MSC_VER) && _MSC_VER >= 1900 // Visual Studio 2015
 #elif defined(_MSC_VER) && _MSC_VER >= 1900 // Visual Studio 2015
 #  define CONSTEXPR constexpr
 #  define CONSTEXPR constexpr
 #  define NOEXCEPT noexcept
 #  define NOEXCEPT noexcept