llvm-project/clang/test/Sema/init-invalid-struct-array.c
Aleksandr Platonov 3fa0a039ab [clang] Check expr inside InitListChecker::UpdateStructuredListElement()
- Prevent nullptr-deference at try to emit warning for invalid `expr`
- Simplify `InitListChecker::UpdateStructuredListElement()` usages. We do not need to check `expr` and increment `StructuredIndex` (for invalid `expr`) before the call anymore.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D85193
2020-08-12 22:12:43 +03:00

9 lines
194 B
C

// RUN: %clang_cc1 %s -verify -fsyntax-only
struct S {
Unknown u; // expected-error {{unknown type name 'Unknown'}}
int i;
};
// Should not crash
struct S s[] = {[0].i = 0, [1].i = 1, {}};