Skip to content

Commit 737f6dd

Browse files
committed
just return a reference to the union value in emplace()
1 parent c54292e commit 737f6dd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libcxx/include/__expected/expected.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ class expected {
402402
}
403403
std::construct_at(std::addressof(__union_.__val_), std::forward<_Args>(__args)...);
404404
__has_val_ = true;
405-
return *std::addressof(__union_.__val_);
405+
return __union_.__val_;
406406
}
407407

408408
template <class _Up, class... _Args>
@@ -415,7 +415,7 @@ class expected {
415415
}
416416
std::construct_at(std::addressof(__union_.__val_), __il, std::forward<_Args>(__args)...);
417417
__has_val_ = true;
418-
return *std::addressof(__union_.__val_);
418+
return __union_.__val_;
419419
}
420420

421421

0 commit comments

Comments
 (0)