diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 4a1455b70..4af721006 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -10196,10 +10196,12 @@ void Tokenizer::reportUnknownMacros() const unknownMacroError(tok); } } else if (Token::Match(tok, "%name% (") && tok->isUpperCaseName() && Token::Match(tok->linkAt(1), ") %name% (") && Token::Match(tok->linkAt(1)->linkAt(2), ") [;{]")) { - if (possible.count(tok->str()) == 0) - possible.insert(tok->str()); - else - unknownMacroError(tok); + if (!(tok->linkAt(1)->next() && tok->linkAt(1)->next()->isKeyword())) { // e.g. noexcept(true) + if (possible.count(tok->str()) == 0) + possible.insert(tok->str()); + else + unknownMacroError(tok); + } } } diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 3c38140f5..d3c2e9c3a 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -6551,6 +6551,9 @@ private: const char code10[] = "void f(std::exception c) { b(M() M() + N(c.what())); }"; ASSERT_THROW(tokenizeAndStringify(code10), InternalError); + + const char code11[] = "struct B { B(B&&) noexcept {} ~B() noexcept {} };"; + ASSERT_NO_THROW(tokenizeAndStringify(code11)); } void findGarbageCode() { // Test Tokenizer::findGarbageCode()