summaryrefslogtreecommitdiffstats
path: root/test/std/utilities/tuple/tuple.tuple/tuple.cnstr
Commit message (Collapse)AuthorAgeFilesLines
* Update all bug URL's to point to https://bugs.llvm.org/...Eric Fiselier2017-02-172-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@295434 91177308-0d34-0410-b5e6-96231b3b80d8
* [libcxx] [test] Fix comment typos.Stephan T. Lavavej2017-02-051-1/+1
| | | | | | No functional change, no code review. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294160 91177308-0d34-0410-b5e6-96231b3b80d8
* [libcxx] [test] Fix comment typos, strip trailing whitespace.Stephan T. Lavavej2017-01-182-4/+4
| | | | | | No functional change, no code review. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292434 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix unused parameters and variablesEric Fiselier2016-12-234-8/+11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290459 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix XFAILS for is_trivially_destructible traitEric Fiselier2016-12-151-3/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@289802 91177308-0d34-0410-b5e6-96231b3b80d8
* Add tests for LWG 2796Eric Fiselier2016-12-151-0/+38
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@289780 91177308-0d34-0410-b5e6-96231b3b80d8
* Add more test cases for PR31384Eric Fiselier2016-12-151-9/+59
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@289778 91177308-0d34-0410-b5e6-96231b3b80d8
* Add test case for PR31384Eric Fiselier2016-12-151-0/+38
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@289774 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r289727 due to PR31384Eric Fiselier2016-12-151-154/+0
| | | | | | | | This patch reverts the changes to tuple which fixed construction from types derived from tuple. It breaks the code mentioned in llvm.org/PR31384. I'll follow this commit up with a test case. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@289773 91177308-0d34-0410-b5e6-96231b3b80d8
* Work around bug in initialization of std::array base class with older clangsEric Fiselier2016-12-141-2/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@289741 91177308-0d34-0410-b5e6-96231b3b80d8
* [libcxx] Fix tuple construction/assignment from types derived from ↵Eric Fiselier2016-12-141-0/+150
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | tuple/pair/array. Summary: The standard requires tuple have the following constructors: ``` tuple(tuple<OtherTypes...> const&); tuple(tuple<OtherTypes...> &&); tuple(pair<T1, T2> const&); tuple(pair<T1, T2> &&); tuple(array<T, N> const&); tuple(array<T, N> &&); ``` However libc++ implements these as a single constructor with the signature: ``` template <class TupleLike, enable_if_t<__is_tuple_like<TupleLike>::value>> tuple(TupleLike&&); ``` This causes the constructor to reject types derived from tuple-like types; Unlike if we had all of the concrete overloads, because they cause the derived->base conversion in the signature. This patch fixes this issue by detecting derived types and the tuple-like base they are derived from. It does this by creating an overloaded function with signatures for each of tuple/pair/array and checking if the possibly derived type can convert to any of them. This patch fixes [PR17550]( https://llvm.org/bugs/show_bug.cgi?id=17550) This patch Reviewers: mclow.lists, K-ballo, mpark, EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D27606 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@289727 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR27374 - Remove the implicit reduced-arity-extension in tuple.Eric Fiselier2016-12-081-7/+14
| | | | | | | | | | | | | | | | | | | This patch removes libc++'s tuple extension which allowed it to be constructed from fewer initializers than elements; with the remaining elements being default constructed. However the implicit version of this extension breaks conforming code. For example: int fun(std::string); int fun(std::tuple<std::string, int>); int x = fun("hello"); // ambigious Because existing code may already depend on this extension it can be re-enabled by defining _LIBCPP_ENABLE_TUPLE_IMPLICIT_REDUCED_ARITY_EXTENSION. Note that the explicit version of this extension is still supported, although it's somewhat less useful than the implicit one. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@289158 91177308-0d34-0410-b5e6-96231b3b80d8
* [libcxx] [test] Fix MSVC warning C4244 "conversion from 'X' to 'Y', possible ↵Stephan T. Lavavej2016-12-086-50/+50
| | | | | | | | | | | | | | | | | | | | | loss of data", part 5/7. Instead of storing double in double and then truncating to int, store int in long and then widen to long long. This preserves test coverage (as these tests are interested in various tuple conversions) while avoiding truncation warnings. test/std/utilities/tuple/tuple.tuple/tuple.cnstr/const_pair.pass.cpp Since we aren't physically truncating anymore, t1 is equal to p0. test/std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_copy.pass.cpp One edit is different from the usual pattern. Previously, we were storing double in double and then converting to A, which has an implicitly converting constructor from int. Now, we're storing int in int and then converting to A, avoiding the truncation. Fixes D27542. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@289109 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR30979 - tuple<move_only> is constructible from move_only const&Eric Fiselier2016-11-131-0/+50
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@286774 91177308-0d34-0410-b5e6-96231b3b80d8
* [libcxx] [test] Replace _LIBCPP_STD_VER with TEST_STD_VER.Stephan T. Lavavej2016-11-045-7/+15
| | | | | | | | | | | This replaces every occurrence of _LIBCPP_STD_VER in the tests with TEST_STD_VER. Additionally, for every affected file, #include "test_macros.h" is being added explicitly if it wasn't already there. https://reviews.llvm.org/D26294 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@286007 91177308-0d34-0410-b5e6-96231b3b80d8
* Make tuple_constructible and family lazy again.Eric Fiselier2016-07-021-0/+102
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274413 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR27684 - std::tuple no longer accepts reference to incomplete type in ↵Eric Fiselier2016-06-212-20/+56
| | | | | | | | | | | | | | | | | | some cases. Libc++ has to deduce the 'allocator_arg_t' parameter as 'AllocArgT' for the following constructor: template <class Alloc> tuple(allocator_arg_t, Alloc const&) Previously libc++ has tried to support tags derived from 'allocator_arg_t' by using 'is_base_of<AllocArgT, allocator_arg_t>'. However this breaks whenever a 2-tuple contains a reference to an incomplete type as its first parameter. See https://llvm.org/bugs/show_bug.cgi?id=27684 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273334 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove trailing whitespace in test suite. Approved by Marshall Clow.Eric Fiselier2016-06-013-5/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@271435 91177308-0d34-0410-b5e6-96231b3b80d8
* Guard testing of tuple extensions to make tests portableEric Fiselier2016-05-274-2/+15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@271065 91177308-0d34-0410-b5e6-96231b3b80d8
* Make tuples constructors conditionally EXPLICIT. See N4387Eric Fiselier2016-04-1911-3/+285
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@266703 91177308-0d34-0410-b5e6-96231b3b80d8
* Cleanup and guard tuple's constructor SFINAE. Fixes PR22806 and PR23256.Eric Fiselier2016-04-153-2/+278
| | | | | | | | | | | | | | | | | | | | | There are two main fixes in this patch. First the constructor SFINAE was changed so that it's evaluated in two stages where the first stage evaluates the "safe" SFINAE conditions and the second evaluates the "dangerous" ones. The key is that the second stage is lazily evaluated only if the first stage passes. This helps fix PR23256 (https://llvm.org/bugs/show_bug.cgi?id=23256). The second fix is for PR22806 and LWG issue 2549. This fix applies the suggested resolution to the LWG issue in order to prevent the construction of dangling references. The SFINAE for this check is contained within the _PreferTupleLikeConstructor alias template. The tuple-like constructors are disabled whenever that trait returns false. (https://llvm.org/bugs/show_bug.cgi?id=22806) (http://cplusplus.github.io/LWG/lwg-active.html#2549) git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@266461 91177308-0d34-0410-b5e6-96231b3b80d8
* [libcxx] Remove the "reduced-arity-initialization" extension from the ↵Eric Fiselier2016-04-152-55/+98
| | | | | | | | | | | | | | | | | uses-allocator constructors Summary: A default uses-allocator constructor has been added since that overload was previously provided by the extended constructor. Since Clang does implicit conversion checking after substitution this constructor has to deduce the allocator_arg_t parameter so that it can prevent the evaluation of "is_default_constructible" if the first argument doesn't match. See http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1391 for more information. This patch fixes PR24779 (https://llvm.org/bugs/show_bug.cgi?id=24779) Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19006 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@266409 91177308-0d34-0410-b5e6-96231b3b80d8
* [libc++] Try and prevent evaluation of `is_default_constructible` on tuples ↵Eric Fiselier2015-02-211-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | default constructor if it is not needed. Summary: Currently parts of the SFINAE on tuples default constructor always gets evaluated even when the default constructor is never called or instantiated. This can cause a hard compile error when a tuple is created with types that do not have a default constructor. Below is a self contained example using a pair like class. This code will not compile but probably should. ``` #include <type_traits> template <class T> struct IllFormedDefaultImp { IllFormedDefaultImp(T x) : value(x) {} constexpr IllFormedDefaultImp() {} T value; }; typedef IllFormedDefaultImp<int &> IllFormedDefault; template <class T, class U> struct pair { template <bool Dummy = true, class = typename std::enable_if< std::is_default_constructible<T>::value && std::is_default_constructible<U>::value && Dummy>::type > constexpr pair() : first(), second() {} pair(T const & t, U const & u) : first(t), second(u) {} T first; U second; }; int main() { int x = 1; IllFormedDefault v(x); pair<IllFormedDefault, IllFormedDefault> p(v, v); } ``` One way to fix this is to use `Dummy` in a more involved way in the constructor SFINAE. The following patch fixes these sorts of hard compile errors for tuple. Reviewers: mclow.lists, rsmith, K-ballo, EricWF Reviewed By: EricWF Subscribers: ldionne, cfe-commits Differential Revision: http://reviews.llvm.org/D7569 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@230120 91177308-0d34-0410-b5e6-96231b3b80d8
* Mark more tuple tests as unsupported in C++98 && C++03Eric Fiselier2015-02-191-0/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@229810 91177308-0d34-0410-b5e6-96231b3b80d8
* [libcxx] Mark most tuple tests UNSUPPORTED for c++03 and c++98.Eric Fiselier2015-02-1922-0/+44
| | | | | | | | | | | | | | Summary: No declaration for the type `tuple` is given in c++03 or c++98 modes. Mark all tests that use the actual `tuple` type as UNSUPPORTED. Reviewers: jroelofs, mclow.lists, danalbert Reviewed By: danalbert Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5956 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@229808 91177308-0d34-0410-b5e6-96231b3b80d8
* Get tests running with warnings. Fix warnings in headers and testsEric Fiselier2015-02-053-3/+7
| | | | git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@228344 91177308-0d34-0410-b5e6-96231b3b80d8
* We had two identical files named 'MoveOnly.h' in the test suite. Move one to ↵Marshall Clow2015-01-285-5/+5
| | | | | | support/, remove the other, and update all the tests that included them. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@227370 91177308-0d34-0410-b5e6-96231b3b80d8
* Walter Brown sent a list of tests which needed 'additional includes' to ↵Marshall Clow2015-01-092-0/+2
| | | | | | match what was in the standard. Added these includes to the tests. No changes to the library or test results. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225541 91177308-0d34-0410-b5e6-96231b3b80d8
* Move test into test/std subdirectory.Eric Fiselier2014-12-2023-0/+1645
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224658 91177308-0d34-0410-b5e6-96231b3b80d8