[cfe-commits] [PATCH] Improved error recovery in for-statement

John McCall rjmccall at apple.com
Thu Feb 3 13:39:37 PST 2011


On Feb 3, 2011, at 1:05 PM, Douglas Gregor wrote:
> Second, just setting the initializer with VD->setInit() is going to cause huge problems down the line, because the initializer needs to be checked and converted by Sema. At the very least, we'd need a call to Sema::AddInitializerToDecl. However, this happens too late in semantic analysis (after Sema::ActOnUnitializedDecl is called) for this to actually work. For example, we will already have complained if the variable has reference type or has no valid default constructor.

I would add that this concern about the parser doing semantic analysis is exactly why the parser isn't supposed to #include anything from AST, so any patch that finds itself adding such an #include is generally wrong.

John.



More information about the cfe-commits mailing list