davrec added inline comments.

================
Comment at: clang/lib/AST/ASTContext.cpp:12367
+  case Type::Class:                                                            
\
+    llvm_unreachable("Unexpected " Kind ": " #Class);
+
----------------
mizvekov wrote:
> davrec wrote:
> > Could we just return `X` here? Would that just default to the old behavior 
> > instead of crashing whenever unforeseen cases arise?  
> No, I think we should enforce the invariants and make sure we are handling 
> everything that can be handled.
> 
> Classing `TemplateTypeParm`  as sugar-free was what was wrong and we missed 
> this on the review.
There might always going to be a few rare corner cases vulnerable to this 
though, particularly as more types are added and the people adding them don't 
pay strict attention to how to incorporate them here, and don't write the 
requisite tests (which seem very difficult to foresee and produce).  When those 
cases arise we will be crashing even though we could produce a perfectly good 
program with the intended semantics; the only thing that would suffer for most 
users is slightly less clear diagnostic messages for those rare cases.  I think 
it would be better to let those cases gradually percolate to our attention via 
bug reports concerning those diagnostics, rather than inconveniencing the user 
and demanding immediate attention via crashes.  Or am I missing something?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111283

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

Reply via email to