diff --git a/lib/Sema/CSGen.cpp b/lib/Sema/CSGen.cpp index 8c8989b7373e5..30b8a206c8a71 100644 --- a/lib/Sema/CSGen.cpp +++ b/lib/Sema/CSGen.cpp @@ -1301,7 +1301,7 @@ namespace { ctx.Id_Regex.str()); return Type(); } - SmallVector matchElements {ctx.getSubstringType()}; + SmallVector matchElements; if (decodeRegexCaptureTypes(ctx, E->getSerializedCaptureStructure(), /*atomType*/ ctx.getSubstringType(), @@ -1310,6 +1310,7 @@ namespace { diag::regex_capture_types_failed_to_decode); return Type(); } + assert(!matchElements.empty() && "Should have decoded at least an atom"); if (matchElements.size() == 1) return BoundGenericStructType::get( regexDecl, Type(), matchElements.front().getType());