File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -1011,9 +1011,9 @@ class ConstExprEmitter
10111011 }
10121012
10131013 mlir::Attribute VisitCXXDefaultInitExpr (CXXDefaultInitExpr *die, QualType t) {
1014- cgm. errorNYI (die-> getBeginLoc (),
1015- " ConstExprEmitter::VisitCXXDefaultInitExpr " );
1016- return {} ;
1014+ // No need for a DefaultInitExprScope: we don't handle 'this' in a
1015+ // constant expression.
1016+ return Visit (die-> getExpr (), t) ;
10171017 }
10181018
10191019 mlir::Attribute VisitExprWithCleanups (ExprWithCleanups *e, QualType t) {
Original file line number Diff line number Diff line change @@ -15,6 +15,16 @@ S partial_init = { 1 };
1515// LLVM: @partial_init = global %struct.S { i32 1, i32 0, i32 0 }
1616// OGCG: @partial_init = global %struct.S { i32 1, i32 0, i32 0 }
1717
18+ struct StructWithDefaultInit {
19+ int a = 2 ;
20+ };
21+
22+ StructWithDefaultInit swdi = {};
23+
24+ // CIR: cir.global external @swdi = #cir.const_record<{#cir.int<2> : !s32i}> : !rec_StructWithDefaultInit
25+ // LLVM: @swdi = global %struct.StructWithDefaultInit { i32 2 }, align 4
26+ // OGCG: @swdi = global %struct.StructWithDefaultInit { i32 2 }, align 4
27+
1828void init () {
1929 S s1 = {1 , 2 , 3 };
2030 S s2 = {4 , 5 };
You can’t perform that action at this time.
0 commit comments