Skip to content

Commit d36d97f

Browse files
committed
Remove most expansion-statement-specific code
1 parent b7f7147 commit d36d97f

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

clang/lib/Sema/SemaStmt.cpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2411,21 +2411,13 @@ void NoteForRangeBeginEndFunction(Sema &SemaRef, Expr *E,
24112411
/// Build a variable declaration for a for-range statement.
24122412
VarDecl *BuildForRangeVarDecl(Sema &SemaRef, SourceLocation Loc, QualType Type,
24132413
StringRef Name, bool ForExpansionStmt) {
2414-
// Making the variable constexpr doesn't automatically add 'const' to the
2415-
// type, so do that now.
2416-
if (ForExpansionStmt && !Type->isReferenceType())
2417-
Type = Type.withConst();
2418-
24192414
DeclContext *DC = SemaRef.CurContext;
24202415
IdentifierInfo *II = &SemaRef.PP.getIdentifierTable().get(Name);
24212416
TypeSourceInfo *TInfo = SemaRef.Context.getTrivialTypeSourceInfo(Type, Loc);
24222417
VarDecl *Decl = VarDecl::Create(SemaRef.Context, DC, Loc, Loc, II, Type,
24232418
TInfo, SC_None);
24242419
Decl->setImplicit();
24252420
Decl->setCXXForRangeImplicitVar(true);
2426-
if (ForExpansionStmt)
2427-
// CWG 3044: Do not make the variable 'static'.
2428-
Decl->setConstexpr(true);
24292421
return Decl;
24302422
}
24312423
}
@@ -2739,10 +2731,7 @@ Sema::ForRangeBeginEndInfo Sema::BuildCXXForRangeBeginEndVars(
27392731
return {};
27402732

27412733
// P2718R0 - Lifetime extension in range-based for loops.
2742-
//
2743-
// CWG 3043 – Do not apply lifetime extension to iterating
2744-
// expansion statements.
2745-
if (getLangOpts().CPlusPlus23 && !ForExpansionStmt)
2734+
if (getLangOpts().CPlusPlus23)
27462735
ApplyForRangeOrExpansionStatementLifetimeExtension(RangeVar,
27472736
LifetimeExtendTemps);
27482737

0 commit comments

Comments
 (0)