[PATCH] D86354: [ADT] Make Optional a literal type.
Varun Gandhi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 26 12:39:09 PDT 2020
varungandhi-apple added a subscriber: davezarzycki.
varungandhi-apple added a comment.
> This seems to only allow empty optionals to be constexpr. Should the non-default constructor also be constexpr?
The reason I implemented the minimal thing was that I wasn't sure how far I should go. In a Swift PR <https://github.com/apple/swift/pull/33118#issuecomment-668818658>, @davezarzycki raised the point about `constexpr` potentially leading to longer compile times even when not used for compile-time computation. I asked some folks internally at Apple and the response I got was along the lines of, "That's surprising... If that's actually the case, it should be reported as a Clang bug". I haven't been able to dedicate time to benchmarking the impact of `constexpr` on compile time... Since `Optional` is a currency type, I wasn't sure if people would object to more methods being marked constexpr. In principle, I don't see any reason for any method on `Optional` to not be constexpr.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86354/new/
https://reviews.llvm.org/D86354
More information about the llvm-commits
mailing list