Commit Graph

659 Commits

Author SHA1 Message Date
Marshall Clow
edd7e051d4 Implement P0550R2: Transformation Trait remove_cvref
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@318011 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-13 03:59:22 +00:00
Marshall Clow
c6934a38d5 Add a fail test for aligned_union of an incomplete type. See LWG#2979. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@316969 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-31 00:05:17 +00:00
Benjamin Kramer
5384fd8538 Placate unused variable warnings uncovered by improvements to clang's -Wunused-variable
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@315809 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-14 15:52:38 +00:00
Roger Ferrer Ibanez
2f494f7331 Remove unneeded typename from test
Differential Revision: https://reviews.llvm.org/D38628



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@315278 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-10 07:42:19 +00:00
Eric Fiselier
2b7279cb08 Fix accidental assignment inside test asserts
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@314947 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-04 23:21:18 +00:00
Eric Fiselier
8a29c9d39b Add C++17 explicit deduction guides to std::pair.
This patch adds the newly standardized deduction guides
for std::pair, allowing it to work class template deduction.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@314864 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-04 00:04:26 +00:00
Eric Fiselier
f7aaaaaa65 Fix two failing -verify tests to tolerate old and new clang versions
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@313502 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-17 21:50:59 +00:00
Eric Fiselier
dfcb00a2c5 Fix failing -verify tests due to change in Clangs static_assert message.
Clang recently changed the way it outputs static assert diagnostics.
This patch fixes libc++'s -verify tests so they tolerate both the old
and new message format.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@313499 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-17 20:57:05 +00:00
Eric Fiselier
63d88110cc Fix accidental ADL in std::allocator_traits meta-programming.
There were a number of cases where __double_underscore functions,
for example __has_construct_test, were called without being qualified,
causing ADL to occur. This patch qualifies those calls to avoid this
problem.

Thanks to David L. Jones for point out the issue initially.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@313324 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-15 00:31:38 +00:00
Eric Fiselier
f2c4a96359 Fix PR34298 - Allow std::function with an incomplete return type.
This patch fixes llvm.org/PR34298. Previously libc++ incorrectly evaluated
the __invokable trait via the converting constructor `function(Tp)` [with Tp = std::function]
whenever the copy constructor or copy assignment operator
was required. This patch further constrains that constructor to short
circut before evaluating the troublesome SFINAE when `Tp` matches
std::function.

The original patch is from Alex Lorenz.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@312892 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-10 23:41:20 +00:00
Eric Fiselier
d5a494e058 Revert "Fix PR34298 - Allow std::function with an incomplete return type."
This reverts commit r312890 because the test case fails to compile for
older versions of Clang that reject initializing a const object without
a user defined constructor.

Since this patch should go into 5.0.1, I want to keep it an atomic change,
and will re-commit it with a fixed test case.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@312891 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-10 23:37:47 +00:00
Eric Fiselier
f83132a4d1 Fix PR34298 - Allow std::function with an incomplete return type.
This patch fixes llvm.org/PR34298. Previously libc++ incorrectly evaluated
the __invokable trait via the converting constructor `function(Tp)` [with Tp = std::function]
whenever the copy constructor or copy assignment operator
was required. This patch further constrains that constructor to short
circut before evaluating the troublesome SFINAE when `Tp` matches
std::function.

The original patch is from Alex Lorenz.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@312890 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-10 23:12:33 +00:00
Casey Carter
08242cbd9b [test] Cleanup nullopt_t tests
* Update specification text from N4387

* Delete not_brace_initializable.fail.cpp: it's redundant with nullopt_t.fail.cpp

* is_empty<T> implies is_class<T>

* is_literal is deprecated; directly verify that we can create a nullopt_t in a constexpr context

Differential Revision: D37024

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@312256 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-31 17:56:31 +00:00
Stephan T. Lavavej
e8c8bc9433 [libcxx] [test] Update for C++17 feature removals.
test/std/containers/Emplaceable.h
test/std/containers/NotConstructible.h
test/support/counting_predicates.hpp
Replace unary_function/binary_function inheritance with typedefs.

test/std/depr/depr.function.objects/depr.base/binary_function.pass.cpp
test/std/depr/depr.function.objects/depr.base/unary_function.pass.cpp
test/std/utilities/function.objects/func.require/binary_function.pass.cpp
test/std/utilities/function.objects/func.require/unary_function.pass.cpp
Mark these tests as requiring 98/03/11/14 because 17 removed unary_function/binary_function.

test/std/thread/futures/futures.task/futures.task.members/ctor_func_alloc.pass.cpp
test/std/thread/futures/futures.task/futures.task.nonmembers/uses_allocator.pass.cpp
Mark these tests as requiring 11/14 because 17 removed packaged_task allocator support.

test/std/utilities/function.objects/func.wrap/func.wrap.func/derive_from.pass.cpp
This test doesn't need to be skipped in C++17 mode. Only the construction of
std::function from an allocator needs to be skipped in C++17 mode.

test/std/utilities/function.objects/refwrap/refwrap.access/conversion.pass.cpp
test/std/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp
test/std/utilities/function.objects/refwrap/refwrap.const/copy_ctor.pass.cpp
test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp
When testing these reference_wrapper features, unary_function inheritance is totally irrelevant.

test/std/utilities/function.objects/refwrap/weak_result.pass.cpp
Define and use my_unary_function/my_binary_function to test the weak result type machinery
(which is still present in C++17, although deprecated).

test/support/msvc_stdlib_force_include.hpp
Now we can test C++17 strictly, without enabling removed features.

Fixes D36503.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@311705 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-24 21:24:08 +00:00
Stephan T. Lavavej
b859a78a6f [libcxx] [test] Rename _Up to U, etc. NFCI.
This improves readability and (theoretically) improves portability,
as _Ugly names are reserved.

This performs additional de-uglification, so all of these tests
follow the example of iterator.traits/empty.pass.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@310761 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-11 20:54:09 +00:00
Stephan T. Lavavej
302557b724 [libcxx] [test] Rename _Tp to T. NFCI.
This improves readability and (theoretically) improves portability,
as _Ugly names are reserved.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@310758 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-11 20:53:53 +00:00
Stephan T. Lavavej
6f13bfd436 [libcxx] [test] Fix URLs in comments and make them HTTPS. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@310156 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-05 00:44:24 +00:00
Eric Fiselier
4876a73b0a Mark LWG 2942 as complete
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@309528 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-30 22:28:08 +00:00
Stephan T. Lavavej
5d91f314f1 [libcxx] [test] Change comments to say C++ instead of c++. NFC.
This makes them consistent (many comments already used uppercase).

The special REQUIRES, UNSUPPORTED, and XFAIL comments are excluded from this change.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@309468 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-29 00:55:35 +00:00
Stephan T. Lavavej
a8d0e52d11 [libcxx] [test] In func.wrap.func.con/alloc_F.pass.cpp, fix REQUIRES whitespace. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@309466 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-29 00:55:25 +00:00
Stephan T. Lavavej
25072f0004 [libcxx] [test] Make files consistently end with newlines, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@309465 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-29 00:55:22 +00:00
Stephan T. Lavavej
a686caad20 [libcxx] [test] Untabify, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@309464 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-29 00:55:10 +00:00
Stephan T. Lavavej
6e76840323 [libcxx] [test] Remove an unused local typedef in enable_shared_from_this.pass.cpp.
Trivial change, committed without review.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@309322 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-27 21:16:37 +00:00
Marshall Clow
1fae624dcf Disable the deduction guide test I added in 309296 for the moment, while I figure out which compilers don't support deduction guides
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@309307 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-27 18:47:35 +00:00
Marshall Clow
f226a28d61 Implement P0739R0: 'Some improvements to class template argument deduction integration into the standard library' This is an API change (not ABI change) due to a late change in the c++17 standard
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@309296 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-27 17:44:03 +00:00
Eric Fiselier
631d697c62 Fix test failure to to new/delete ellisions
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@307510 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-09 22:20:07 +00:00
Casey Carter
8b30287098 optional: Implement LWG 2900 and P0602
Differential Revision: https://reviews.llvm.org/D32385

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@307505 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-09 17:15:49 +00:00
Marshall Clow
a12318f5ae Added failing tests for index out of range for tuple_element<pair<T1,T2>> and variant_alternative<>
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@306580 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-28 18:18:30 +00:00
Stephan T. Lavavej
3497449a37 [libcxx] [test] Fix -Wmismatched-tags in tuple_size_structured_bindings.pass.cpp.
Clang and C1XX both complain about mismatched class/struct, but libc++ and MSVC's STL
differ on what they use for tuple_element/tuple_size, so there's no way to win here.

I'm reverting this part of my previous change. In the future, I'll have to suppress
the warning for one compiler or the other.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305854 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-20 21:10:53 +00:00
Stephan T. Lavavej
b836deb5db [libcxx] [test] Strip trailing whitespace. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305848 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-20 21:00:02 +00:00
Stephan T. Lavavej
750da9c572 [libcxx] [test] Add more tests to tuple_size_structured_bindings.pass.cpp and make it friendlier to C1XX.
Style/paranoia: 42.1 doesn't have an exact binary representation. Although this doesn't
cause failures, it makes me uncomfortable, so I'm changing it to 42.5.

C1XX rightly warns about unreferenced variables. Adding tests for their values
makes C1XX happy and improves test coverage.

C1XX (somewhat obnoxiously) warns about seeing a struct specialized as a class.
Although the Standard doesn't care, saying struct consistently is better.
(The Standard itself is still inconsistent about whether to depict tuple_element
and tuple_size as structs or classes.)

Fixes D33953.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305843 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-20 20:34:50 +00:00
Michael Park
b47a9bc6c4 Add a missing SFINAE condition to the variant's converting constructor.
Remarks: This function shall not participate in overload resolution unless
         `is_same_v<decay_t<T>, variant>` is false, unless `decay_t<T>` is
         neither a specialization of `in_place_type_t` nor a specialization of
         `in_place_index_t`, unless `is_constructible_v<Tj, T>` is true, and
         unless the expression `FUN(std::forward<T>(t))` (with `FUN` being the
         above-mentioned set of imaginary functions) is well formed.

Depends on D34111.

Reviewers: EricWF, K-ballo

Reviewed By: EricWF

Subscribers: fhahn

Differential Revision: https://reviews.llvm.org/D34112

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305668 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-19 08:25:57 +00:00
Duncan P. N. Exon Smith
2b001ff730 func.wrap.func.con: Fix test comment
This tests moving `function`, not `const function`.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@305648 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-18 15:34:47 +00:00
Stephan T. Lavavej
8ba816b366 [libcxx] [test] Remove a Clang/C2 workaround.
Clang/LLVM doesn't need this workaround.

Fixes D33955.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@304999 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-08 18:21:59 +00:00
Eric Fiselier
c597e3867e XFAIL tuple deduction guide test on GCC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@304969 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-08 08:03:35 +00:00
Eric Fiselier
3113ac6f85 Add tests for class template deduction on std::tuple.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@304967 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-08 07:18:17 +00:00
Michael Park
3762fe69d2 Implement LWG 2904.
Summary:
- Removed the move-constructibe requirement from copy-assignable.
- Updated `__assign_alt` such that we direct initialize if
  `_Tp` can be `nothrow`-constructible from `_Arg`, or `_Tp`'s
  move construction can throw. Otherwise, construct a temporary and move it.
- Updated the tests to remove the pre-LWG2904 path.

Depends on D32671.

Reviewers: EricWF, CaseyCarter

Reviewed By: EricWF

Differential Revision: https://reviews.llvm.org/D33965

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@304891 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-07 10:22:43 +00:00
Eric Fiselier
7457967300 Fix test with exceptions disabled
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@304883 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-07 09:06:05 +00:00
Casey Carter
3da9072b08 [test] Test changes to accommodate LWG 2904 "Make variant move-assignment more exception safe"
Also: Move constexpr / triviality extension tests into the std tree and make them conditional on _LIBCPP_VERSION / _MSVC_STL_VERSION.

https://reviews.llvm.org/D32671

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@304847 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-07 00:06:04 +00:00
Casey Carter
57a009ae03 add missing constexpr to optional::value_or
[Credit to cpplearner]

Differential Revision: https://reviews.llvm.org/D27850

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@304813 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-06 18:47:26 +00:00
Eric Fiselier
efcf07d44a Remove incorrect #ifdef guards around variant tests.
The tests were previously guarded by #if defined(_LIBCPP_VER) || defined(_MSVC_STL_VER),
which is both incorrect (e.g. _LIBCPP_VERSION) and unneeded. Although the tests are
technically non-standard (yet) they are supported by both libc++ and MSVC's STL.

libstdc++ doesn't regularly use the test suite so I'm not concerned about guarding these
tests for them.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@303953 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-26 01:27:08 +00:00
Casey Carter
90b8e58ffa [test] Fix breakage from r303947 =(
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@303951 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-26 01:00:56 +00:00
Casey Carter
fd6177ffd6 [test] make_shared<T()>(...) is, uh, libc++-specific
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@303947 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-26 00:37:33 +00:00
Casey Carter
8b55cce1c8 [test] Workaround C1XX bug in uses_allocator_types.hpp
VSO#109062 "Explicit template argument specification with empty template parameter pack expansion does not imply further empty pack expansion"

Differential Revision: https://reviews.llvm.org/D33214

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@303888 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-25 17:42:17 +00:00
Erik Pilkington
a3e0bf4396 Add support for shared_ptr<FunctionType>
Fixes PR27566.

Differential revision: https://reviews.llvm.org/D30837

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@303874 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-25 15:43:31 +00:00
Marshall Clow
6d52b3b76c Add some constexpr tests for optional's move/copy ctor
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@303824 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-25 00:22:33 +00:00
Marshall Clow
6a5647485a Mark the copy constructor and move
constructor to be constexpr. This only works when the contained type has a constexpr copy/move ctor.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@303268 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-17 15:30:01 +00:00
Eric Fiselier
e250cc68ce Cleanup test issues reported by STL @ Microsoft.
This patch cleans up a number of issues reported by STL, including:

1) Fix duplicate is_convertible test.
2) Move non-standard reference_wrapper tests under test/libcxx
3) Fix assumption that sizeof(wchar_t) == 32 in the codecvt and
   wstring_convert tests.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@302870 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-12 03:38:28 +00:00
Eric Fiselier
2d31e197db Fix or move tests with non-standard assumptions
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@302862 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-12 01:44:51 +00:00
Marshall Clow
83c266a94f Mark LWG#2782 as complete. No functionality change; we already do this. Just added a few more tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@302802 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-11 14:25:45 +00:00