Skip to content

Commit fdf10f7

Browse files
DanielC314meta-codesync[bot]
authored andcommitted
fix Conv.h
Summary: with clang 21, header units with values returned in lambdas have issues. Tweak Conv.h to avoid the returned value being dropped. Log output example here: https://www.internalfb.com/intern/everpaste/?handle=GH-kWCUQuyFjyH8HAJ2urzob_hEBbswMAAAz from D109588369 Reviewed By: skrueger Differential Revision: D109888758 fbshipit-source-id: e1d554acababbbaf8575e1f92dd0fcca58eb74fb
1 parent f25665d commit fdf10f7

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

‎folly/Conv.h‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,15 +1493,16 @@ inline
14931493
detail::CheckTrailingSpace,
14941494
detail::ReturnUnit<Error>>::type;
14951495
auto tmp = detail::parseToWrap(src, result);
1496-
return tmp
1496+
// returning outside of lambda to avoid clang 21 header-unit bug
1497+
tmp.thenOrThrow(
1498+
Check(),
1499+
[&](Error e) { throw_exception(makeConversionError(e, src)); })
14971500
.thenOrThrow(
1498-
Check(),
1499-
[&](Error e) { throw_exception(makeConversionError(e, src)); })
1500-
.thenOrThrow(
1501-
[&](Unit) { return std::move(result); },
1501+
[&](Unit) {},
15021502
[&](Error e) {
15031503
throw_exception(makeConversionError(e, tmp.value()));
15041504
});
1505+
return result;
15051506
}
15061507

15071508
/**

0 commit comments

Comments
 (0)