================
@@ -64,13 +103,144 @@ StmtResult Sema::ActOnCXXExpansionStmtPattern(
Expr *ExpansionInitializer, SourceLocation LParenLoc,
SourceLocation ColonLoc, SourceLocation RParenLoc,
ArrayRef<MaterializeTemporaryExpr *> LifetimeExtendTemps) {
+ if (!ExpansionInitializer || !ExpansionVarStmt)
+ return StmtError();
+
+ assert(CurContext->isExpansionStmt());
+ auto *DS = cast<DeclStmt>(ExpansionVarStmt);
+ if (!DS->isSingleDecl()) {
+ Diag(DS->getBeginLoc(), diag::err_type_defined_in_for_range);
+ return StmtError();
----------------
Sirraide wrote:
Hmm, well actually that diagnostic says ‘types may not be defined in a for
range declaration’, and in the standard, _for-range-declaration_ is a grammar
production that is also used for expansion statements; we can change to ‘in the
declaration of an expansion variable’ maybe, but I’m not sure if that’s better
https://github.com/llvm/llvm-project/pull/169682
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits