File tree 2 files changed +15
-3
lines changed 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -1843,7 +1843,7 @@ bool ByteCodeExprGen<Emitter>::VisitCompoundLiteralExpr(
1843
1843
const Expr *Init = E->getInitializer ();
1844
1844
if (Initializing) {
1845
1845
// We already have a value, just initialize that.
1846
- return this ->visitInitializer (Init);
1846
+ return this ->visitInitializer (Init) && this -> emitFinishInit (E) ;
1847
1847
}
1848
1848
1849
1849
std::optional<PrimType> T = classify (E->getType ());
@@ -1862,7 +1862,7 @@ bool ByteCodeExprGen<Emitter>::VisitCompoundLiteralExpr(
1862
1862
return this ->emitInitGlobal (*T, *GlobalIndex, E);
1863
1863
}
1864
1864
1865
- return this ->visitInitializer (Init);
1865
+ return this ->visitInitializer (Init) && this -> emitFinishInit (E) ;
1866
1866
}
1867
1867
1868
1868
return false ;
@@ -1891,7 +1891,7 @@ bool ByteCodeExprGen<Emitter>::VisitCompoundLiteralExpr(
1891
1891
}
1892
1892
return this ->emitInit (*T, E);
1893
1893
} else {
1894
- if (!this ->visitInitializer (Init))
1894
+ if (!this ->visitInitializer (Init) || ! this -> emitFinishInit (E) )
1895
1895
return false ;
1896
1896
}
1897
1897
Original file line number Diff line number Diff line change @@ -245,3 +245,15 @@ void unaryops(void) {
245
245
(void )((struct zz {float x ;}){3 }.x ++ );
246
246
(void )((struct ww {float x ;}){3 }.x -- );
247
247
}
248
+
249
+ /// This used to fail because we didn't properly mark the struct
250
+ /// initialized through a CompoundLiteralExpr as initialized.
251
+ struct TestStruct {
252
+ int a ;
253
+ int b ;
254
+ };
255
+ int Y __attribute__((annotate (
256
+ "GlobalValAnnotationWithArgs" ,
257
+ 42 ,
258
+ (struct TestStruct ) { .a = 1 , .b = 2 }
259
+ )));
You can’t perform that action at this time.
0 commit comments