Commit Graph

33 Commits

Author SHA1 Message Date
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
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
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
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
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
Michael Park
f318b708ef Fix std::visit for the zero variants case.
Summary:
The following code is broken:

```
    std::visit([]{});
```

Reviewers: EricWF

Reviewed By: EricWF

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@302773 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-11 07:17:12 +00:00
Mehdi Amini
907c1196a7 Add markup for libc++ dylib availability
Libc++ is used as a system library on macOS and iOS (amongst others). In order
for users to be able to compile a binary that is intended to be deployed to an
older version of the platform, clang provides the
availability attribute <https://clang.llvm.org/docs/AttributeReference.html#availability>_
that can be placed on declarations to describe the lifecycle of a symbol in the
library.

See docs/DesignDocs/AvailabilityMarkup.rst for more information.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@302172 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-04 17:08:54 +00:00
Casey Carter
d252306885 [test] variant: enable constexpr construction tests on MSVC STL
* Add a new macro _MSVC_STL_VER to detect when the MSVC STL is being tested
* Workaround C1XX __is_trivially_copyable bug

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@302158 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-04 15:32:54 +00:00
Eric Fiselier
98d9a858da Implement LWG 2857 for variant. Tests from Casey Carter @ Microsoft.
Also mark LWG 2857 as complete, since the changes to optional and
any were completed by Marshall earlier.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300403 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-15 19:32:02 +00:00
Michael Park
ad3680b23e Worked around GCC bug 56480. Explicit specialization in a different namespace.
Summary: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480

Reviewers: EricWF

Reviewed By: EricWF

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298581 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-23 06:21:24 +00:00
Marshall Clow
af552ba05a Implement P0599: 'noexcept for hash functions'. Fix a couple of hash functions (optional<T> and unique_ptr<T>) which were mistakenly marked as 'noexcept'. Reviewed as https://reviews.llvm.org/D31234
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298573 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-23 02:40:28 +00:00
Mehdi Amini
d3acadce0c Fix Apple-specific XFAIL directive in libc++ test
These tests are failing in XCode 8.0, 8.1, and 8.2, but not in Xcode
8.3. Annoyingly the version numbering for clang does not follow Xcode
and is bumped to 8.1 only in Xcode 8.3. So Xfailing apple-clang-8.0
should catch all cases here.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@296704 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-01 23:14:34 +00:00
Michael Park
0268c19d72 Updated the XFAIL comment in variant tests.
Summary:
`ConstexprTestTypes::NoCtors` is an aggregate type (and consequently a literal type) in C++17,
but not in C++14 since it has a base class. This patch updates the comment to accurately describe the reason for the XFAIL.

Reviewers: EricWF

Reviewed By: EricWF

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@296558 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-01 01:07:56 +00:00
Eric Fiselier
b7fd0be370 Update all bug URL's to point to https://bugs.llvm.org/...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@295434 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-17 08:37:03 +00:00
Eric Fiselier
d8b62dceb2 Fix PR31916 - std::visit rejects visitors accepting lvalue arguments
A static assertion was misfiring since it checked
is_callable<Visitor, decltype(__variant_alt<T>.value)>. However
the decltype expression doesn't capture the value category as
required. This patch applies extra braces to decltype to fix
that.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294612 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 19:01:22 +00:00
Eric Fiselier
952eaecfc6 Implement P0513R0 - "Poisoning the Hash"
Summary:
Exactly what the title says.

This patch also adds a `std::hash<nullptr_t>` specialization in C++17, but it was not added by this paper and I can't find the actual paper that adds it.

See http://wg21.link/P0513R0 for more info.

If there are no comments in the next couple of days I'll commit this

Reviewers: mclow.lists, K-ballo, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292684 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-21 00:02:12 +00:00
Michael Park
b894a0b46d Added a workaround for a -fdelayed-template-parsing bug.
Summary:
There seems to be an additional bug in `-fdelayed-template-parsing`
similar to
http://llvm.org/viewvc/llvm-project?view=revision&revision=236063.

This is a workaround for it for <variant> to compile with `clang-cl` on Windows.

Reviewers: EricWF

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292097 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-16 08:14:25 +00:00
Eric Fiselier
06192cb774 Mark test as UNSUPPORTED on Windows since it hangs forever
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292012 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-14 10:31:43 +00:00
Eric Fiselier
dceaa0e352 Add gcc-[56] clang-3.[678] to list of XFAILS for variant tests. Patch from Michael Park
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291094 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-05 09:06:30 +00:00
Eric Fiselier
9c6b70a0af Use C++11 static_assert in variant tests. Patch from Michael Park
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291021 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-04 22:43:08 +00:00
Eric Fiselier
20ace04348 Add apple-clang-8 to list of XFAILS for some variant tests. Patch from Michael Park
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290440 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 19:07:54 +00:00
Casey Carter
86e9c5f13d std::get<0>([std::variant constant expression]) *is* noexcept.
Differential review: http://reviews.llvm.org/D27436

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@288760 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-06 02:28:19 +00:00
Eric Fiselier
b0d421ae1e XFAIL variant tests for apple-clang
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@288559 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-03 00:33:03 +00:00
Eric Fiselier
ac5c826faf Work around Clang 3.8 bugs
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@288556 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-03 00:13:33 +00:00
Eric Fiselier
120401a4e0 Make variant's index part of the hash value
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@288554 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 23:38:31 +00:00
Eric Fiselier
cab2af8418 Implement C++17 <variant>. Patch from Michael Park!
This patch was reviewed as https://reviews.llvm.org/D23263.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@288547 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 23:00:05 +00:00
Eric Fiselier
7f2b2c8362 Fix copy/paste errors in new variant tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@288538 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 21:32:35 +00:00
Eric Fiselier
08d07da127 Add tests for libc++'s constexpr variant copy/move extension
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@288536 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 21:17:51 +00:00
Casey Carter
80888fa0fe Don't "LIBCPP_ONLY(stuff;)" at namespace scope.
Differential review: https://reviews.llvm.org/D27029

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@287732 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-23 01:44:53 +00:00
Eric Fiselier
0373708cdc Add <variant> tests but disable them for libc++
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@287728 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-23 01:02:51 +00:00