@@ -749,7 +749,7 @@ static void compileTerm(Token *&tok, AST_state& state)
749749 tok = tok->next ();
750750 } while (Token::Match (tok, " %name%|%str%" ));
751751 } else if (tok->isName ()) {
752- if (Token::Match (tok, " return|case" ) || (state.cpp && (tok->str () == " throw" || Token::simpleMatch (tok-> tokAt (- 1 ), " :: new " ) ))) {
752+ if (Token::Match (tok, " return|case" ) || (state.cpp && (tok->str () == " throw" ))) {
753753 if (tok->str () == " case" )
754754 state.inCase = true ;
755755 const bool tokIsReturn = tok->str () == " return" ;
@@ -1160,6 +1160,10 @@ static void compilePrecedence3(Token *&tok, AST_state& state)
11601160 compilePrecedence2 (tok, state);
11611161 }
11621162 compileUnaryOp (newtok, state, nullptr );
1163+ if (Token::simpleMatch (newtok->previous (), " :: new" )) {
1164+ newtok->previous ()->astOperand1 (newtok);
1165+ state.op .pop ();
1166+ }
11631167 if (innertype && Token::simpleMatch (tok, " ) ," ))
11641168 tok = tok->next ();
11651169 } else if (state.cpp && Token::Match (tok, " delete %name%|*|&|::|(|[" )) {
@@ -1169,6 +1173,10 @@ static void compilePrecedence3(Token *&tok, AST_state& state)
11691173 tok = tok->link ()->next ();
11701174 compilePrecedence3 (tok, state);
11711175 compileUnaryOp (tok2, state, nullptr );
1176+ if (Token::simpleMatch (tok2->previous (), " :: delete" )) {
1177+ tok2->previous ()->astOperand1 (tok2);
1178+ state.op .pop ();
1179+ }
11721180 }
11731181 // TODO: Handle sizeof
11741182 else break ;
0 commit comments