[libcxx-commits] [PATCH] D77563: [libc++] Move C++17 check around optional only in ObjC is_scalar test.
Zoe Carver via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Apr 6 09:12:07 PDT 2020
zoecarver created this revision.
zoecarver added a reviewer: ldionne.
Herald added subscribers: libcxx-commits, broadwaylamb, dexonsmith.
Herald added a project: libc++.
Herald added a reviewer: libc++.
zoecarver marked an inline comment as done.
zoecarver added inline comments.
================
Comment at: libcxx/test/libcxx/type_traits/is_scalar.objc.pass.mm:20
#include <type_traits>
+#if __cplusplus >= 201703L
#include <optional>
----------------
I'm using this because I'm not sure if it will work to include `test_macros.h`.
Check the std version around the use of optional in is_scalar Objective-C test instead of checking the whole file.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D77563
Files:
libcxx/test/libcxx/type_traits/is_scalar.objc.pass.mm
Index: libcxx/test/libcxx/type_traits/is_scalar.objc.pass.mm
===================================================================
--- libcxx/test/libcxx/type_traits/is_scalar.objc.pass.mm
+++ libcxx/test/libcxx/type_traits/is_scalar.objc.pass.mm
@@ -17,7 +17,9 @@
// Make sure we report that blocks are scalar types.
#include <type_traits>
+#if __cplusplus >= 201703L
#include <optional>
+#endif // C++17
struct Foo { };
template <int> struct Arg { };
@@ -35,6 +37,10 @@
int main(int, char**) {
+#if __cplusplus >= 201703L
+ // Make sure that std::optional can be used with a block, which is the
+ // underlying motivation for making blocks satisfy std::is_scalar.
std::optional<Foo (^)(Arg<0>)> opt; (void)opt;
+#endif // C++17
return 0;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77563.255368.patch
Type: text/x-patch
Size: 771 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200406/79468088/attachment-0001.bin>
More information about the libcxx-commits
mailing list