This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by CaseyCarter on Nov 16 2016, 6:33 PM.

Details

Summary

Note that this does not implement the product code changes to <utility> and <any>, this is only the necessary changes to accompanying test code.

Diff Detail

Event Timeline

CaseyCarter retitled this revision from to [libcxx] [test] Test changes for P0504R0 "Revisiting in-place tag types for any/optional/variant".
CaseyCarter updated this object.
CaseyCarter added reviewers: mclow.lists, EricWF.
CaseyCarter added a subscriber: cfe-commits.
CaseyCarter edited edge metadata.

Remove unused reference variable in any_cast_reference.pass.cpp.

mclow.lists edited edge metadata.Nov 16 2016, 9:06 PM

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

test/std/utilities/utility/utility.inplace/inplace.pass.cpp
40

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?"

CaseyCarter marked an inline comment as done.Nov 17 2016, 9:59 AM

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.

test/std/utilities/utility/utility.inplace/inplace.pass.cpp
40

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.

CaseyCarter edited edge metadata.
CaseyCarter marked an inline comment as done.

Don't STATIC_ASSERT; static_assert.

EricWF accepted this revision.Nov 17 2016, 11:27 AM
EricWF edited edge metadata.

LGTM. This patch misses any.modifiers/emplace.pass.cpp but I'll fix that up and commit with the libc++ changes!

This revision is now accepted and ready to land.Nov 17 2016, 11:27 AM
EricWF closed this revision.Nov 17 2016, 11:34 AM

r287249. Thanks again!