diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index df5a862c1..a23f5f97b 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -2761,10 +2761,10 @@ public: if (tok->strAt(-1) != "##") { const std::map::const_iterator it = macros.find(str); if (it != macros.end() && it->second->_macro.find('(') == std::string::npos) { - str = it->second->_macro; - const std::string::size_type whitespacePos = str.find(' '); + const std::string& macro = it->second->_macro; + const std::string::size_type whitespacePos = macro.find(' '); if (whitespacePos != std::string::npos) - str.erase(0, whitespacePos); + str = macro.substr(whitespacePos); else str = ""; }