This commit is contained in:
parent
d939c6015a
commit
a451a5b598
|
@ -599,7 +599,7 @@ static void compileTerm(Token *&tok, AST_state& state)
|
||||||
compileUnaryOp(tok, state, compileExpression);
|
compileUnaryOp(tok, state, compileExpression);
|
||||||
else
|
else
|
||||||
compileBinOp(tok, state, compileExpression);
|
compileBinOp(tok, state, compileExpression);
|
||||||
if (Token::simpleMatch(tok, "} ,")) {
|
if (Token::Match(tok, "} ,|:")) {
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
}
|
}
|
||||||
} else if (!state.inArrayAssignment && !Token::simpleMatch(prev, "=")) {
|
} else if (!state.inArrayAssignment && !Token::simpleMatch(prev, "=")) {
|
||||||
|
|
|
@ -74,6 +74,7 @@ private:
|
||||||
TEST_CASE(tokenize33); // #5780 Various crashes on valid template code
|
TEST_CASE(tokenize33); // #5780 Various crashes on valid template code
|
||||||
TEST_CASE(tokenize34); // #8031
|
TEST_CASE(tokenize34); // #8031
|
||||||
TEST_CASE(tokenize35); // #8361
|
TEST_CASE(tokenize35); // #8361
|
||||||
|
TEST_CASE(tokenize36); // #8436
|
||||||
|
|
||||||
TEST_CASE(validate);
|
TEST_CASE(validate);
|
||||||
|
|
||||||
|
@ -850,6 +851,11 @@ private:
|
||||||
"template<typename T> ::CRCWord const Compute(T const t) { return 0; }");
|
"template<typename T> ::CRCWord const Compute(T const t) { return 0; }");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tokenize36() { // #8436
|
||||||
|
const char code[] = "int foo ( int i ) { return i ? * new int { 5 } : int { i ? 0 : 1 } ; }";
|
||||||
|
ASSERT_EQUALS(code, tokenizeAndStringify(code));
|
||||||
|
}
|
||||||
|
|
||||||
void validate() {
|
void validate() {
|
||||||
// C++ code in C file
|
// C++ code in C file
|
||||||
ASSERT_THROW(tokenizeAndStringify(";using namespace std;",false,false,Settings::Native,"test.c"), InternalError);
|
ASSERT_THROW(tokenizeAndStringify(";using namespace std;",false,false,Settings::Native,"test.c"), InternalError);
|
||||||
|
|
Loading…
Reference in New Issue