diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 8dd6c585e..dc6438bdb 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -8006,6 +8006,8 @@ static bool isNonMacro(const Token* tok) return true; if (tok->str().compare(0, 2, "__") == 0) // attribute/annotation return true; + if (Token::simpleMatch(tok, "alignas (")) + return true; return false; } diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 1bf9ed682..767021a81 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -6770,6 +6770,8 @@ private: const char code11[] = "struct B { B(B&&) noexcept {} ~B() noexcept {} };"; ASSERT_NO_THROW(tokenizeAndStringify(code11)); + + ASSERT_NO_THROW(tokenizeAndStringify("alignas(8) alignas(16) int x;")); // alignas is not unknown macro } void findGarbageCode() { // Test Tokenizer::findGarbageCode()