Skip to content

Commit 70d89eb

Browse files
authored
std.variant: Fix deprecation in VariantN.opApply() (#10910)
'Deprecation: cannot return non-zero compile-time value from `opApply`' Hit e.g. when compiling the unittests.
1 parent bcdaa07 commit 70d89eb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

std/variant.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,7 +1207,7 @@ public:
12071207
auto arr = get!(A[]);
12081208
foreach (ref e; arr)
12091209
{
1210-
if (dg(e)) return 1;
1210+
if (auto r = dg(e)) return r;
12111211
}
12121212
}
12131213
else static if (is(A == VariantN))
@@ -1219,7 +1219,7 @@ public:
12191219
// Variant when in fact they are only changing tmp.
12201220
auto tmp = this[i];
12211221
debug scope(exit) assert(tmp == this[i]);
1222-
if (dg(tmp)) return 1;
1222+
if (auto r = dg(tmp)) return r;
12231223
}
12241224
}
12251225
else

0 commit comments

Comments
 (0)