parent
8fb8e06003
commit
e8b37235d6
|
@ -692,7 +692,7 @@ static bool iscpp11init_impl(const Token * const tok)
|
|||
return true;
|
||||
const Token *prev = nameToken;
|
||||
while (Token::Match(prev, "%name%|::|:|<|>|,")) {
|
||||
if (Token::Match(prev, "class|struct"))
|
||||
if (Token::Match(prev, "class|struct|union|enum"))
|
||||
return false;
|
||||
|
||||
prev = prev->previous();
|
||||
|
@ -996,8 +996,12 @@ static void compilePrecedence2(Token *&tok, AST_state& state)
|
|||
Token* curlyBracket = roundBracket->link()->next();
|
||||
while (Token::Match(curlyBracket, "mutable|const|constexpr|consteval"))
|
||||
curlyBracket = curlyBracket->next();
|
||||
if (Token::simpleMatch(curlyBracket, "noexcept ("))
|
||||
curlyBracket = curlyBracket->linkAt(1)->next();
|
||||
if (Token::simpleMatch(curlyBracket, "noexcept")) {
|
||||
if (Token::simpleMatch(curlyBracket->next(), "("))
|
||||
curlyBracket = curlyBracket->linkAt(1)->next();
|
||||
else
|
||||
curlyBracket = curlyBracket->next();
|
||||
}
|
||||
if (curlyBracket && curlyBracket->originalName() == "->")
|
||||
curlyBracket = findTypeEnd(curlyBracket->next());
|
||||
if (curlyBracket && curlyBracket->str() == "{") {
|
||||
|
|
|
@ -6533,6 +6533,9 @@ private:
|
|||
" return a < b;\n"
|
||||
" });\n"
|
||||
"}\n"));
|
||||
|
||||
// #11378
|
||||
ASSERT_EQUALS("gT{(&[{= 0return", testAst("auto g = T{ [&]() noexcept -> int { return 0; } };"));
|
||||
}
|
||||
|
||||
void astcase() {
|
||||
|
@ -7493,6 +7496,10 @@ private:
|
|||
testIsCpp11init("namespace { TEST(a, b) {} }", // anonymous namespace
|
||||
"{ TEST",
|
||||
TokenImpl::Cpp11init::NOINIT);
|
||||
|
||||
testIsCpp11init("enum { e = decltype(s)::i };",
|
||||
"{ e",
|
||||
TokenImpl::Cpp11init::NOINIT);
|
||||
#undef testIsCpp11init
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue