There was an error while loading. Please reload this page.
1 parent 5799d47 commit d0ae85dCopy full SHA for d0ae85d
1 file changed
lib/tokenize.cpp
@@ -566,11 +566,18 @@ namespace {
566
const auto checkForRecursion = [this]() {
567
if (Token::Match(mTypedefToken, "typedef %name% %name% ;"))
568
return;
569
+ int nBraces = 0;
570
for (const Token *tok = mTypedefToken; tok != mEndToken; tok = tok->next()) {
571
+ if (tok->str() == "{")
572
+ ++nBraces;
573
+ else if (tok->str() == "}")
574
+ --nBraces;
575
if (tok == mNameToken)
576
continue;
577
if (tok->str() != mNameToken->str())
578
579
+ if (nBraces > 0 && Token::simpleMatch(tok->next(), ";"))
580
+ continue;
581
if (Token::Match(tok->previous(), "struct|class|enum|union"))
582
583
throw InternalError(tok, "recursive typedef encountered");
0 commit comments