From 7a0576546cf8cd336ffdd89774d229c5b3ece53a Mon Sep 17 00:00:00 2001 From: Florian Rupprecht Date: Tue, 23 Nov 2021 16:00:14 +0100 Subject: [PATCH 1/5] GCC 8 workaround --- include/crow/app.h | 4 ++++ include/crow/settings.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/include/crow/app.h b/include/crow/app.h index 3d2f22fb8..ef4cec30d 100644 --- a/include/crow/app.h +++ b/include/crow/app.h @@ -82,6 +82,9 @@ namespace crow ///Create a route using a rule (**Use CROW_ROUTE instead**) template +#ifdef CROW_GCC8_WORKAROUND + auto& route(std::string&& rule) +#else auto route(std::string&& rule) #ifdef CROW_CAN_USE_CPP17 -> typename std::invoke_result), @@ -89,6 +92,7 @@ namespace crow #else -> typename std::result_of)( Router, std::string&&)>::type +#endif #endif { return router_.new_rule_tagged(std::move(rule)); diff --git a/include/crow/settings.h b/include/crow/settings.h index bdbd068b0..a38cf7b73 100644 --- a/include/crow/settings.h +++ b/include/crow/settings.h @@ -57,3 +57,7 @@ #define noexcept throw() #endif #endif + +#if __GNUC__ == 8 && __cplusplus > 201103L +#define CROW_GCC8_WORKAROUND +#endif From 58e211355fe9ee2772c94800d981b08596169fdf Mon Sep 17 00:00:00 2001 From: Florian Rupprecht Date: Thu, 25 Nov 2021 15:14:45 +0100 Subject: [PATCH 2/5] Constrain and warn GCC 8 bug --- include/crow/app.h | 2 +- include/crow/settings.h | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/crow/app.h b/include/crow/app.h index ef4cec30d..d8845deb2 100644 --- a/include/crow/app.h +++ b/include/crow/app.h @@ -82,7 +82,7 @@ namespace crow ///Create a route using a rule (**Use CROW_ROUTE instead**) template -#ifdef CROW_GCC8_WORKAROUND +#ifdef CROW_GCC83_WORKAROUND auto& route(std::string&& rule) #else auto route(std::string&& rule) diff --git a/include/crow/settings.h b/include/crow/settings.h index a38cf7b73..1437036c7 100644 --- a/include/crow/settings.h +++ b/include/crow/settings.h @@ -58,6 +58,10 @@ #endif #endif -#if __GNUC__ == 8 && __cplusplus > 201103L -#define CROW_GCC8_WORKAROUND +#if __GNUC__ == 8 && __GNUC_MINOR__ < 4 +#if __cplusplus > 201103L +#define CROW_GCC83_WORKAROUND +#else +#warning "GCC 8.1 - 8.3 have a bug that prevents crow from compiling with C++11. Please update GCC to > 8.3 or use C++ > 11." +#endif #endif From df50e3390d9483938bb543edbd10473b74a86e60 Mon Sep 17 00:00:00 2001 From: Florian Rupprecht Date: Thu, 25 Nov 2021 15:16:34 +0100 Subject: [PATCH 3/5] Spelling --- include/crow/settings.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/crow/settings.h b/include/crow/settings.h index 1437036c7..4600e2d8e 100644 --- a/include/crow/settings.h +++ b/include/crow/settings.h @@ -62,6 +62,6 @@ #if __cplusplus > 201103L #define CROW_GCC83_WORKAROUND #else -#warning "GCC 8.1 - 8.3 have a bug that prevents crow from compiling with C++11. Please update GCC to > 8.3 or use C++ > 11." +#warning "GCC 8.1 - 8.3 has a bug that prevents crow from compiling with C++11. Please update GCC to > 8.3 or use C++ > 11." #endif #endif From 7ee13c4536a87cda1f35fbf89b238327056c1a05 Mon Sep 17 00:00:00 2001 From: Florian Rupprecht Date: Sat, 27 Nov 2021 14:30:37 +0100 Subject: [PATCH 4/5] GCC 8 workaround compiler detection & error --- include/crow/settings.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/crow/settings.h b/include/crow/settings.h index 4600e2d8e..b2c1c4f50 100644 --- a/include/crow/settings.h +++ b/include/crow/settings.h @@ -58,10 +58,10 @@ #endif #endif -#if __GNUC__ == 8 && __GNUC_MINOR__ < 4 +#if defined(__GNUC__) && __GNUC__ == 8 && __GNUC_MINOR__ < 4 #if __cplusplus > 201103L #define CROW_GCC83_WORKAROUND #else -#warning "GCC 8.1 - 8.3 has a bug that prevents crow from compiling with C++11. Please update GCC to > 8.3 or use C++ > 11." +#error "GCC 8.1 - 8.3 has a bug that prevents crow from compiling with C++11. Please update GCC to > 8.3 or use C++ > 11." #endif #endif From 24d8a72a94942ad49c343c1c584b8f898a078b9e Mon Sep 17 00:00:00 2001 From: Florian Rupprecht <33600480+nx10@users.noreply.github.com> Date: Sat, 4 Dec 2021 12:32:32 +0100 Subject: [PATCH 5/5] Update include/crow/app.h Co-authored-by: Farook Al-Sammarraie --- include/crow/app.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/crow/app.h b/include/crow/app.h index 938b5f7a1..6e7d05f13 100644 --- a/include/crow/app.h +++ b/include/crow/app.h @@ -83,11 +83,11 @@ namespace crow auto& route(std::string&& rule) #else auto route(std::string&& rule) -#ifdef CROW_CAN_USE_CPP17 - -> typename std::invoke_result), Router, std::string&&>::type -#else - -> typename std::result_of)(Router, std::string&&)>::type #endif +#if defined CROW_CAN_USE_CPP17 && !defined CROW_GCC83_WORKAROUND + -> typename std::invoke_result), Router, std::string&&>::type +#elif !defined CROW_GCC83_WORKAROUND + -> typename std::result_of)(Router, std::string&&)>::type #endif { return router_.new_rule_tagged(std::move(rule));