[cfe-dev] Should we build semantically invalid nodes?

Argiris Kirtzidis akyrtzi at gmail.com
Thu Oct 23 10:47:43 PDT 2008


Sebastian Redl wrote:
> From a purely practical standpoint, and possibly a minor issue, 
> disallowing the construction of AST elements for invalid code means 
> that for EXTENSION-diagnostics I also have to check for 
> -pedantic-errors myself and prevent AST construction in this case.
>
> I don't know how widespread use of those is. There's one in 
> CheckReinterpretCast.

This is an excellent example for that the syntax tree and the semantic 
checks are somewhat orthogonal. The fact that a syntactic construct is 
semantically valid or invalid based on a compiler flag, does not affect 
the ability of Sema to handle it later on.

-Argiris



More information about the cfe-dev mailing list