sammccall added a comment.

Unless I'm wildly misremembering (@hokein knows better), the type should also 
be dependent in C.

The intuition is that the code has some meaning that depends on how the error 
is resolved (by the programmer changing the code!), and that "dependent" is a 
good first-approximation way to model this (defer further analysis, suppress 
diagnostics) and "contains-errors" allows us to specifically handle the cases 
that need it.

Of course this allows dependent constructs to occur in new places, in 
non-template code in C++ (this was handled quite early), and also in C (this is 
why the "all languages" D89046 <https://reviews.llvm.org/D89046> came later).

I'm surprised this only came up now! Ideally I think we'd use 
`DependentSizedArrayType` as the types of these variables, dependent types are 
supposed to work in C. It seems OK to have mergeTypes() return QualType() for 
types that have errors in them - this will result in a followup diagnostic that 
ideally we'd drop, but we also emit that diagnostic in this case in C++. You 
could also make the case for returning the first type, or the type with errors, 
or the type without errors (i.e. *assume* that the types are the same after 
errors are fixed).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149612/new/

https://reviews.llvm.org/D149612

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to