================ @@ -727,6 +729,44 @@ void InitListChecker::FillInEmptyInitForField(unsigned Init, FieldDecl *Field, if (hadError || VerifyOnly) { // Do nothing } else if (Init < NumInits) { ---------------- zygoloid wrote:
Hm, right, we still call this with `Init >= NumInits` when in `VerifyOnly` mode (but *only* in that mode). My concern here is that we're only warning in the `Init < NumInits` case, which is in principle wrong -- we should warn regardless of whether `Init < NumInits`. But in fact, the caller always resizes the `InitListExpr` so that `Init >= NumInits` whenever we're not in `VerifyOnly` mode, so I think this is probably not *actually* wrong, but it still *looks* wrong. To make it not look wrong, I think we should remove all the dead code here: instead of checking whether `Init < NumInits` in non-`VerifyOnly` mode, we should assert that `Init < NumInits`, and delete the unreachable code that is trying to handle the impossible case: lines 684-685, 704-707, 772-778. Does that make sense? https://github.com/llvm/llvm-project/pull/70829 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits