Fixed segfault #4182
This commit is contained in:
parent
54f1771938
commit
ce9f6bdb56
|
@ -2528,7 +2528,7 @@ static bool setVarIdParseDeclaration(const Token **tok, const std::map<std::stri
|
||||||
} else if (!hasstruct && variableId.find(tok2->str()) != variableId.end() && tok2->previous()->str() != "::") {
|
} else if (!hasstruct && variableId.find(tok2->str()) != variableId.end() && tok2->previous()->str() != "::") {
|
||||||
++typeCount;
|
++typeCount;
|
||||||
tok2 = tok2->next();
|
tok2 = tok2->next();
|
||||||
if (tok2->str() != "::")
|
if (!tok2 || tok2->str() != "::")
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
++typeCount;
|
++typeCount;
|
||||||
|
|
|
@ -63,6 +63,7 @@ private:
|
||||||
TEST_CASE(wrong_syntax3); // #3544
|
TEST_CASE(wrong_syntax3); // #3544
|
||||||
TEST_CASE(wrong_syntax4); // #3618
|
TEST_CASE(wrong_syntax4); // #3618
|
||||||
TEST_CASE(wrong_syntax_if_macro); // #2518 - if MACRO()
|
TEST_CASE(wrong_syntax_if_macro); // #2518 - if MACRO()
|
||||||
|
TEST_CASE(garbageCode);
|
||||||
|
|
||||||
TEST_CASE(foreach); // #3690
|
TEST_CASE(foreach); // #3690
|
||||||
|
|
||||||
|
@ -702,6 +703,10 @@ private:
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void garbageCode() {
|
||||||
|
tokenizeAndStringify("struct x foo_t; foo_t typedef y;");
|
||||||
|
}
|
||||||
|
|
||||||
void foreach() {
|
void foreach() {
|
||||||
// #3690
|
// #3690
|
||||||
const std::string code("void f() { for each ( char c in MyString ) { Console::Write(c); } }");
|
const std::string code("void f() { for each ( char c in MyString ) { Console::Write(c); } }");
|
||||||
|
|
Loading…
Reference in New Issue