[PATCH] D26782: [libcxx] [test] Test changes for P0504R0 "Revisiting in-place tag types for any/optional/variant"

Casey Carter via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 17 09:59:29 PST 2016


CaseyCarter marked an inline comment as done.
CaseyCarter added a comment.

> Do these tests pass with the current `<any>` implementation, or will they have to wait?

These tests **do not pass** without making the changes required in P0504R0 to `<utility>` and `<any>`.  (Interestingly <optional> is unaffected; its use of `in_place_t` and `in_place` is source-compatible despite the changed definitions of those names.) I would have made those changes as well, but my request for permission to contribute changes to non-test code hasn't yet returned from the void into which I cast it. If neither of you get around to it, I may put an hour into it over the weekend.



================
Comment at: test/std/utilities/utility/utility.inplace/inplace.pass.cpp:40
 
-template <class Tp>
-struct CheckRet : std::false_type {};
-template <class Arg>
-struct CheckRet<std::in_place_tag(Arg)> : std::true_type {};
+#define STATIC_ASSERT(...) static_assert((__VA_ARGS__), #__VA_ARGS__)
 
----------------
mclow.lists wrote:
> Please just use `static_assert(x)` instead.  Since this is C++1z only, you don't need to supply a message. If the test fails, the compiler will give you file and line #.
> 
> If I see an all caps `STATIC_ASSERT`, then my first bit of research has to be "how is this different from `static_assert`?"
> 
`static_assert(false);` in Visual C++ diagnoses with the incredibly informative:

> inplace.pass.cpp(59): error C2607: static assertion failed

so I've developed this habit which inadvertently leaked into the diff. Fixing.


https://reviews.llvm.org/D26782





More information about the cfe-commits mailing list