fix clang testsuite crash (#2341)

This commit is contained in:
IOBYTE 2019-11-09 12:00:21 -05:00 committed by Daniel Marjamäki
parent 81fff2edf1
commit 0fed6f0091
2 changed files with 12 additions and 0 deletions

View File

@ -10890,6 +10890,8 @@ void Tokenizer::simplifyOperatorName()
op += par->strAt(1);
par = par->tokAt(2);
done = true;
} else if (par->str() != "(") {
syntaxError(par);
}
}

View File

@ -237,6 +237,7 @@ private:
TEST_CASE(garbageCode203); // #8972
TEST_CASE(garbageCode204);
TEST_CASE(garbageCode205);
TEST_CASE(garbageCode206);
TEST_CASE(garbageCodeFuzzerClientMode1); // test cases created with the fuzzer client, mode 1
@ -1625,6 +1626,15 @@ private:
"}"); // don't crash
}
void garbageCode206() {
{
ASSERT_EQUALS("[test.cpp:1] syntax error", getSyntaxError("void foo() { for (auto operator new : int); }"));
}
{
ASSERT_EQUALS("[test.cpp:1] syntax error", getSyntaxError("void foo() { for (a operator== :) }"));
}
}
void syntaxErrorFirstToken() {
ASSERT_THROW(checkCode("&operator(){[]};"), InternalError); // #7818
ASSERT_THROW(checkCode("*(*const<> (size_t); foo) { } *(*const (size_t)() ; foo) { }"), InternalError); // #6858