[PATCH] D86354: [ADT] Make Optional a literal type.

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 26 12:37:14 PDT 2020


dblaikie accepted this revision.
dblaikie added inline comments.


================
Comment at: llvm/unittests/ADT/OptionalTest.cpp:20-23
+static_assert(
+    std::is_literal_type<optional_detail::OptionalStorage<int>>::value,
+    "Optional should be usable in constexpr");
+
----------------
This might be a bit unnecessary, if the test below is adequate? (this seems like a place where testing on the public interface would be sufficient & make it easier if the implementation details are refactored later)


================
Comment at: llvm/unittests/ADT/OptionalTest.cpp:24
+
+static_assert(std::is_literal_type<Optional<int>>::value,
+              "Optional should be usable in constexpr");
----------------
is_literal_type is deprecated in C++17 and removed in C++20 - might be better to test the property in practical terms by making some constexpr variables (in test cases, or not)
```
constexpr Optional<int> o;
```
etc?


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