[PATCH] D27850: [libcxx] add missing constexpr to optional::value_or
Eric Fiselier via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 27 11:42:48 PST 2016
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.
The changes to `<optional>` LGTM but not the ones to `<experimental/optional>`
Unfortunately libc++'s `<experimental/optional>` doesn't yet implement LFTS v2 so all of the other non-const observers are also not constexpr in our implementation. I think updating `<experimental/optional>` to LFTS v2 should be done as a separate patch. Please back out the changes to `<experimental/optional>` before committing.
================
Comment at: test/std/experimental/optional/optional.object/optional.object.observe/value_or.pass.cpp:48
+ if (!(std::move(opt).value_or(y) == 2)) std::abort();
+ if (!(*opt == 0)) std::abort();
}
----------------
This test doesn't compile since the non-const version of `std::experimental::optional::operator*()` isn't constexpr.
https://reviews.llvm.org/D27850
More information about the cfe-commits
mailing list