File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -3702,6 +3702,10 @@ def err_conflicting_codeseg_attribute : Error<
37023702def warn_duplicate_codeseg_attribute : Warning<
37033703 "duplicate code segment specifiers">, InGroup<Section>;
37043704
3705+ def err_expansion_stmt_vla : Error<
3706+ "cannot expand variable length array type %0">;
3707+ def err_expansion_stmt_incomplete : Error<
3708+ "cannot expand expression of incomplete type %0">;
37053709def err_expansion_stmt_lambda : Error<
37063710 "cannot expand lambda closure type">;
37073711
Original file line number Diff line number Diff line change @@ -287,6 +287,17 @@ StmtResult Sema::BuildNonEnumeratingCXXExpansionStmtPattern(
287287 RParenLoc);
288288 }
289289
290+ if (RequireCompleteType (ExpansionInitializer->getExprLoc (),
291+ ExpansionInitializer->getType (),
292+ diag::err_expansion_stmt_incomplete))
293+ return StmtError ();
294+
295+ if (ExpansionInitializer->getType ()->isVariableArrayType ()) {
296+ Diag (ExpansionInitializer->getExprLoc (), diag::err_expansion_stmt_vla)
297+ << ExpansionInitializer->getType ();
298+ return StmtError ();
299+ }
300+
290301 // Otherwise, if it can be an iterating expansion statement, it is one.
291302 DeclRefExpr *Index = BuildIndexDRE (*this , ESD);
292303 IterableExpansionStmtData Data = TryBuildIterableExpansionStmtInitializer (
You can’t perform that action at this time.
0 commit comments