From a5216b282828a3e7ff86d11d61daafa0a002f87b Mon Sep 17 00:00:00 2001 From: firewave Date: Tue, 3 Jan 2023 03:06:30 +0100 Subject: [PATCH] only perform `__has_include` simplification if code is C++17 or later --- simplecpp.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/simplecpp.cpp b/simplecpp.cpp index ff72d412..f66fcdaa 100755 --- a/simplecpp.cpp +++ b/simplecpp.cpp @@ -2540,6 +2540,9 @@ static bool isCpp17OrLater(const simplecpp::DUI &dui) static std::string openHeader(std::ifstream &f, const simplecpp::DUI &dui, const std::string &sourcefile, const std::string &header, bool systemheader); static void simplifyHasInclude(simplecpp::TokenList &expr, const simplecpp::DUI &dui) { + if (!isCpp17OrLater(dui)) + return; + for (simplecpp::Token *tok = expr.front(); tok; tok = tok->next) { if (tok->str() != HAS_INCLUDE) continue;