File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1582,7 +1582,7 @@ StmtResult Parser::ParseForStatement(SourceLocation *TrailingElseLoc) {
15821582 ScopeFlags = Scope::DeclScope | Scope::ControlScope;
15831583
15841584 // HLSL Change Starts - leak declarations in for control parts into outer scope
1585- if (getLangOpts ().HLSL ) {
1585+ if (getLangOpts ().HLSLVersion < 2021 ) {
15861586 ScopeFlags = Scope::ForDeclScope;
15871587 }
15881588 // HLSL Change Ends
Original file line number Diff line number Diff line change 1+ // RUN: %clang_cc1 -fsyntax-only -ffreestanding -verify -HV 2021 %s
2+
3+ uint g_count1;
4+ uint g_count2;
5+ Buffer <float4 > Things;
6+
7+ float4 main () : SV_Target
8+ {
9+ float4 data=0 ;
10+ for ( uint i=0 ; i<g_count1; i++ )
11+ {
12+ data += Things[i];
13+ }
14+
15+ // not-expected-warning@+1:{{redefinition of 'i'}}
16+ for ( uint i=0 ; i<g_count2; i++ )
17+ {
18+ data += Things[g_count1+i];
19+ }
20+
21+ return data;
22+ }
You can’t perform that action at this time.
0 commit comments