diff --git a/Telegram/SourceFiles/base/assertion.h b/Telegram/SourceFiles/base/assertion.h index 1711e1504..cd638d563 100644 --- a/Telegram/SourceFiles/base/assertion.h +++ b/Telegram/SourceFiles/base/assertion.h @@ -30,6 +30,8 @@ void log(const char *message, const char *file, int line); // Release build assertions. inline constexpr void noop() { + // MSVC2015 requires return to suppress warning: a constexpr function must contain exactly one return statement + return void(); } [[noreturn]] inline void fail(const char *message, const char *file, int line) { @@ -43,14 +45,9 @@ inline constexpr void noop() { std::abort(); } -// Since MSVC 2015 cannot understand "constexpr void" (void is literal since C++14) -// we have to use conditional compilation -inline -#if !defined(_MSC_VER) || (_MSC_VER > 1900) -constexpr -#endif - void validate(bool condition, const char *message, const char *file, int line) { - (GSL_UNLIKELY(!(condition))) ? fail(message, file, line) : noop(); +inline constexpr void validate(bool condition, const char *message, const char *file, int line) { + // MSVC2015 requires return to suppress error C3249: illegal statement or sub-expression for 'constexpr' function + return (GSL_UNLIKELY(!(condition))) ? fail(message, file, line) : noop(); }