diff --git a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp index 46948c12617c..49855305cecc 100644 --- a/clang/lib/StaticAnalyzer/Core/RegionStore.cpp +++ b/clang/lib/StaticAnalyzer/Core/RegionStore.cpp @@ -1849,8 +1849,12 @@ std::optional RegionStoreManager::getSValFromInitListExpr( // Go to the nested initializer list. ILE = IL; } - llvm_unreachable( - "Unhandled InitListExpr sub-expressions or invalid offsets."); + + assert(ILE); + + // FIXME: Unhandeled InitListExpr sub-expression, possibly constructing an + // enum? + return std::nullopt; } /// Returns an SVal, if possible, for the specified position in a string diff --git a/clang/test/Analysis/initialization.cpp b/clang/test/Analysis/initialization.cpp index e5b94ea7d0a2..e624ef5bae9e 100644 --- a/clang/test/Analysis/initialization.cpp +++ b/clang/test/Analysis/initialization.cpp @@ -249,3 +249,10 @@ void glob_array_parentheses1() { clang_analyzer_eval(glob_arr9[1][2] == 7); // expected-warning{{TRUE}} clang_analyzer_eval(glob_arr9[1][3] == 0); // expected-warning{{TRUE}} } + +enum class E {}; +const E glob[] = {{}}; +void initlistWithinInitlist() { + // no-crash + clang_analyzer_dump(glob[0]); // expected-warning-re {{reg_${{[0-9]+}}}} +}