I've noticed that during ambiguity resolution in the following code CDT parser tries to resolve bindings that should not be necessary for ambiguity resolution.The statement
contains an ambiguity between CPPASTDeclarationStatement and CPPASTExpressionStatement. This ambiguity is currently resolved by counting problems in the whole statement and choosing the alternative that produces fewer problems. This means that the parser makes two attempts to resolve waldo, both for the declaration and for the _expression_ alternatives. This looks excessive since absence of problems in the type specifier should be sufficient to conclude that the statement is a declaration. Name resolution in the initializer should not be necessary. Likewise, absence of problems in the first operand of the binary _expression_ contained in the _expression_ statement alternative should be sufficient to conclude that the statement is an _expression_.
Does anybody know why ambiguity resolution always tries to resolve all names under the ambiguous node?
-sergey