File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -2025,7 +2025,7 @@ bool ByteCodeExprGen<Emitter>::VisitLambdaExpr(const LambdaExpr *E) {
2025
2025
if (!this ->visit (Init))
2026
2026
return false ;
2027
2027
2028
- if (!this ->emitSetField (*T, F.Offset , E))
2028
+ if (!this ->emitInitField (*T, F.Offset , E))
2029
2029
return false ;
2030
2030
} else {
2031
2031
if (!this ->emitDupPtr (E))
Original file line number Diff line number Diff line change @@ -248,3 +248,19 @@ namespace ns2_capture_this_byval {
248
248
constexpr auto L = S{5 }.f(S{10 });
249
249
static_assert (L(S{100 }) == 115 , " " );
250
250
} // end test_captures_1::ns2_capture_this_byval
251
+
252
+ namespace CaptureDefaults {
253
+ struct S {
254
+ int x;
255
+ };
256
+
257
+ constexpr auto f = [x = S{10 }]() {
258
+ return x.x ;
259
+ };
260
+ static_assert (f() == 10 , " " );
261
+
262
+ constexpr auto f2 = [x = 3 ]() {
263
+ return x;
264
+ };
265
+ static_assert (f2() == 3 , " " );
266
+ }
You can’t perform that action at this time.
0 commit comments