diff --git a/include/crow/app.h b/include/crow/app.h index 605a700d5..264d37b51 100644 --- a/include/crow/app.h +++ b/include/crow/app.h @@ -79,12 +79,16 @@ namespace crow return router_.new_rule_dynamic(std::move(rule)); } - /// Create a route using a rule (**Use CROW_ROUTE instead**) + ///Create a route using a rule (**Use CROW_ROUTE instead**) template - auto route(std::string&& rule) -#ifdef CROW_CAN_USE_CPP17 - -> typename std::invoke_result), Router, std::string&&>::type +#ifdef CROW_GCC83_WORKAROUND + auto& route(std::string&& rule) #else + auto route(std::string&& rule) +#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 { diff --git a/include/crow/settings.h b/include/crow/settings.h index bdbd068b0..b2c1c4f50 100644 --- a/include/crow/settings.h +++ b/include/crow/settings.h @@ -57,3 +57,11 @@ #define noexcept throw() #endif #endif + +#if defined(__GNUC__) && __GNUC__ == 8 && __GNUC_MINOR__ < 4 +#if __cplusplus > 201103L +#define CROW_GCC83_WORKAROUND +#else +#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