erichkeane wrote:

> This feels like Dejavu, since I reviewed a very similar issue not long ago.
> 
> My suggestion is to avoid relying on isInvalidDecl for error recovery, as 
> this is a very fragile.
> 
> You can make sure error recovery for the primary template always produces a 
> template with a valid type, by recovering an invalid / unknown type as if the 
> user had written 'int'.

Getting error recovery to produce a valid template type is actually REALLY 
fragile as well, and would be a massive amount of re-write, we leave 
empty/invalid decls all over the place.  It is also actually quite important 
that we mark decls as 'invalid' in quite a few places, as it saves us from 
having to hit recursion problems in quite a few places.

`!Expr`, or `ExprResult::IsUsable/IsInvalid` are REALLY common ways we use to 
detect failures and give up.  IMO, its the right answer in Decls as well, and 
what we do fairly consistently.

The Deja-Vu you are getting is because of `RecoveryExpr`, which is a 75% 
implemented feature that we're still working through the kinks of.

https://github.com/llvm/llvm-project/pull/202006
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to