File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Expand file tree Collapse file tree 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(
18431843 const Expr *Init = E->getInitializer ();
18441844 if (Initializing) {
18451845 // We already have a value, just initialize that.
1846- return this ->visitInitializer (Init);
1846+ return this ->visitInitializer (Init) && this -> emitFinishInit (E) ;
18471847 }
18481848
18491849 std::optional<PrimType> T = classify (E->getType ());
@@ -1862,7 +1862,7 @@ bool ByteCodeExprGen<Emitter>::VisitCompoundLiteralExpr(
18621862 return this ->emitInitGlobal (*T, *GlobalIndex, E);
18631863 }
18641864
1865- return this ->visitInitializer (Init);
1865+ return this ->visitInitializer (Init) && this -> emitFinishInit (E) ;
18661866 }
18671867
18681868 return false ;
@@ -1891,7 +1891,7 @@ bool ByteCodeExprGen<Emitter>::VisitCompoundLiteralExpr(
18911891 }
18921892 return this ->emitInit (*T, E);
18931893 } else {
1894- if (!this ->visitInitializer (Init))
1894+ if (!this ->visitInitializer (Init) || ! this -> emitFinishInit (E) )
18951895 return false ;
18961896 }
18971897
Original file line number Diff line number Diff line change @@ -245,3 +245,15 @@ void unaryops(void) {
245245 (void )((struct zz {float x ;}){3 }.x ++ );
246246 (void )((struct ww {float x ;}){3 }.x -- );
247247}
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