summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/utilities/tuple
Commit message (Collapse)AuthorAgeFilesLines
* PR43764: Qualify a couple of calls to forward_as_tuple to be ADL-resilient.David Blaikie2019-10-281-0/+16
|
* [libcxx][test][NFC] Fix comment typos.Stephan T. Lavavej2019-10-222-2/+2
| | | | (Testing git commit access.)
* [libc++] Take 2: Implement LWG 3158Louis Dionne2019-09-272-1/+34
| | | | | | | | | | | | | | | | | | | | | Summary: LWG 3158 marks the allocator_arg_t constructor of std::tuple as conditionnally explicit based on whether the default constructors of the tuple's members are explicitly default constructible. This was previously committed as r372778 and reverted in r372832 due to the commit breaking LLVM's build in C++14 mode. This issue has now been addressed. Reviewers: mclow.lists Subscribers: christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D65232 llvm-svn: 373092
* [libc++] Take 2: Implement LWG 2510Louis Dionne2019-09-262-2/+60
| | | | | | | | | | | | | | | | | | | | | | | Summary: LWG2510 makes tag types like allocator_arg_t explicitly default constructible instead of implicitly default constructible. It also makes the constructors for std::pair and std::tuple conditionally explicit based on the explicit-ness of the default constructibility for the pair/tuple's elements. This was previously committed as r372777 and reverted in r372832 due to the commit breaking LLVM's build in C++14 mode. This issue has now been addressed. Reviewers: mclow.lists Subscribers: christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D65161 llvm-svn: 372983
* [libc++] Purge mentions of GCC 4 from the test suiteLouis Dionne2019-09-252-2/+0
| | | | | | | | | We don't support GCC 4 and older according to the documentation, so we should pretend it doesn't exist. This is a re-application of r372787. llvm-svn: 372916
* Revert r372777: [libc++] Implement LWG 2510 and its follow-upsIlya Biryukov2019-09-256-88/+4
| | | | | | | | | | | | This also reverts: - r372778: [libc++] Implement LWG 3158 - r372782: [libc++] Try fixing tests that fail on GCC 5 and older - r372787: Purge mentions of GCC 4 from the test suite Reason: the change breaks compilation of LLVM with libc++, for details see http://lists.llvm.org/pipermail/libcxx-dev/2019-September/000599.html llvm-svn: 372832
* [libc++] Purge mentions of GCC 4 from the test suiteLouis Dionne2019-09-243-3/+1
| | | | | | | We don't support GCC 4 and older according to the documentation, so we should pretend it doesn't exist. llvm-svn: 372787
* [libc++] Try fixing tests that fail on GCC 5 and olderLouis Dionne2019-09-241-0/+4
| | | | llvm-svn: 372782
* [libc++] Implement LWG 3158Louis Dionne2019-09-242-1/+34
| | | | | | | | | | | | | | | | | Summary: LWG 3158 marks the allocator_arg_t constructor of std::tuple as conditionnally explicit based on whether the default constructors of the tuple's members are explicitly default constructible. Reviewers: EricWF, mclow.lists Subscribers: christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D65232 llvm-svn: 372778
* [libc++] Implement LWG 2510Louis Dionne2019-09-242-1/+50
| | | | | | | | | | | | | | | | | | | Summary: LWG2510 makes tag types like allocator_arg_t explicitly default constructible instead of implicitly default constructible. It also makes the constructors for std::pair and std::tuple conditionally explicit based on the explicit-ness of the default constructibility for the pair/tuple's elements. Reviewers: mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D65161 llvm-svn: 372777
* Fix various test failures with GCCEric Fiselier2019-09-131-1/+1
| | | | llvm-svn: 371880
* libcxx: Rename .hpp files in libcxx/test/support to .hNico Weber2019-08-212-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | LLVM uses .h as its extension for header files. Files renamed using: for f in libcxx/test/support/*.hpp; do git mv $f ${f%.hpp}.h; done References to the files updated using: for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do a=$(basename $f); echo $a; rg -l $a libcxx | xargs sed -i '' "s/$a/${a%.hpp}.h/"; done HPP include guards updated manually using: for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do echo ${f%.hpp}.h ; done | xargs mvim Differential Revision: https://reviews.llvm.org/D66104 llvm-svn: 369481
* [libc++] Mark std::tuple CTAD test as failing on AppleClang 9Louis Dionne2019-08-141-0/+1
| | | | | | | | Like CTAD for std::unordered_set, AppleClang 9's support for CTAD is insufficient. I suspect the corresponding LLVM Clang is broken too, but we don't seem to have testers using that Clang. llvm-svn: 368911
* [libc++] Implement CTAD for std::tupleLouis Dionne2019-08-121-13/+57
| | | | | | | | | | | | | | | | | | | | | Summary: We were using implicit deduction guides instead of explicit ones, however the implicit ones don't do work anymore when changing the constructors. This commit adds the actual guides specified in the Standard to make libc++ (1) closer to the Standard and (2) more resistent to changes in std::tuple's constructors. Reviewers: Quuxplusone Subscribers: christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D65225 llvm-svn: 368599
* Fix non-conformance it `std::tuple`.Eric Fiselier2019-07-121-0/+16
| | | | | | | | | | | | | | Previously we implemented all one trillion tuple-like constructors using a single generic overload. This worked fairly well, except that it differed in behavior from the standard version because it didn't consider both T&& and T const&. This was observable for certain types. This patch addresses that issue by splitting the generic constructor in two. We now provide both T&& and T const& versions of the tuple-like constructors (sort of). llvm-svn: 365973
* Fix tuple's conditionally explicit constructors for very weird userEric Fiselier2019-07-031-0/+14
| | | | | | | | | | | | types. It seems some people like to write types that can explicitly convert to anything, but cannot be used to explicitly construct anything. This patch makes tuple tolerate such types, as is required by the standard. llvm-svn: 365074
* Add include for 'test_macros.h' to all the tests that were missing them. ↵Marshall Clow2019-05-3142-0/+69
| | | | | | Thanks to Zoe for the (big, but simple) patch. NFC intended. llvm-svn: 362252
* add tuple_cat test for const TEric Fiselier2019-04-261-6/+6
| | | | llvm-svn: 359256
* Fix return type of std::tuple_cat.Eric Fiselier2019-04-261-0/+15
| | | | | | | | | | | | When the arguments to tuple cat were const, the const was incorrectly propagated into the type of the resulting tuple. For example: const std::tuple<int> t(42); auto r = std::tuple_cat(t, t); // Incorrect! should be std::tuple<int, int>. static_assert(is_same_v<decltype(r), std::tuple<const int, const int>>); llvm-svn: 359255
* [libc++] Declare std::tuple_element as struct instead of classLouis Dionne2019-04-014-8/+4
| | | | | | | | | | | | Similarly to https://reviews.llvm.org/rL350972, this revision changes std::tuple_element from class to struct. Fixes PR41331. Thanks to Jan Wilken Dörrie for the patch. Differential Revision: https://reviews.llvm.org/D60069 llvm-svn: 357411
* [libc++] Use UNSUPPORTED instead of TEST_STD_VER #ifdefLouis Dionne2019-02-051-7/+2
| | | | | | | | | | | When the whole test only works starting at some version of the Standard, use UNSUPPORTED lit markup instead of #ifdef TEST_STD_VER. This provides more visibility into the test suite. Reviewed as https://reviews.llvm.org/D57704. Thanks to Andrey Maksimov for the patch. llvm-svn: 353206
* Support tests in freestandingJF Bastien2019-02-0478-79/+235
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Freestanding is *weird*. The standard allows it to differ in a bunch of odd manners from regular C++, and the committee would like to improve that situation. I'd like to make libc++ behave better with what freestanding should be, so that it can be a tool we use in improving the standard. To do that we need to try stuff out, both with "freestanding the language mode" and "freestanding the library subset". Let's start with the super basic: run the libc++ tests in freestanding, using clang as the compiler, and see what works. The easiest hack to do this: In utils/libcxx/test/config.py add: self.cxx.compile_flags += ['-ffreestanding'] Run the tests and they all fail. Why? Because in freestanding `main` isn't special. This "not special" property has two effects: main doesn't get mangled, and main isn't allowed to omit its `return` statement. The first means main gets mangled and the linker can't create a valid executable for us to test. The second means we spew out warnings (ew) and the compiler doesn't insert the `return` we omitted, and main just falls of the end and does whatever undefined behavior (if you're luck, ud2 leading to non-zero return code). Let's start my work with the basics. This patch changes all libc++ tests to declare `main` as `int main(int, char**` so it mangles consistently (enabling us to declare another `extern "C"` main for freestanding which calls the mangled one), and adds `return 0;` to all places where it was missing. This touches 6124 files, and I apologize. The former was done with The Magic Of Sed. The later was done with a (not quite correct but decent) clang tool: https://gist.github.com/jfbastien/793819ff360baa845483dde81170feed This works for most tests, though I did have to adjust a few places when e.g. the test runs with `-x c`, macros are used for main (such as for the filesystem tests), etc. Once this is in we can create a freestanding bot which will prevent further regressions. After that, we can start the real work of supporting C++ freestanding fairly well in libc++. <rdar://problem/47754795> Reviewers: ldionne, mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, arphaman, miyuki, libcxx-commits Differential Revision: https://reviews.llvm.org/D57624 llvm-svn: 353086
* Update more file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1980-320/+240
| | | | | | | | | | | | | | | | | | to reflect the new license. These used slightly different spellings that defeated my regular expressions. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351648
* Change from a to a . Fixes PR#39871.Marshall Clow2019-01-113-8/+8
| | | | llvm-svn: 350972
* [NFC] Normalize some test 'main' signaturesJF Bastien2019-01-091-2/+1
| | | | | | There were 3 tests with 'int main(void)', and 6 with the return type on a different line. I'm about to send a patch for main in tests, and this NFC change is unrelated. llvm-svn: 350770
* Portability fix: add missing includes and static_casts. Reviewed as ↵Marshall Clow2018-12-182-0/+2
| | | | | | https://reviews.llvm.org/D55777. Thanks to Andrey Maksimov for the patch. llvm-svn: 349566
* [libcxx] [test] Fix MSVC warnings and errors.Stephan T. Lavavej2018-02-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan.pass.cpp test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op.pass.cpp test/std/numerics/numeric.ops/inclusive.scan/inclusive_scan_op_init.pass.cpp test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop.pass.cpp test/std/numerics/numeric.ops/transform.inclusive.scan/transform_inclusive_scan_bop_uop_init.pass.cpp Fix MSVC x64 truncation warnings. warning C4267: conversion from 'size_t' to 'int', possible loss of data test/std/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp Fix MSVC uninitialized memory warning. warning C6001: Using uninitialized memory 'vl'. test/std/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.pass.cpp Include <cassert> for the assert() macro. Fixes D43273. llvm-svn: 326120
* [libc++] Fix PR20855 -- libc++ incorrectly diagnoses illegal reference ↵Eric Fiselier2018-01-241-0/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | binding in std::tuple. Summary: See https://bugs.llvm.org/show_bug.cgi?id=20855 Libc++ goes out of it's way to diagnose `std::tuple` constructions which are UB due to lifetime bugs caused by reference creation. For example: ``` // The 'const std::string&' is created *inside* the tuple constructor, and its lifetime is over before the end of the constructor call. std::tuple<int, const std::string&> t(std::make_tuple(42, "abc")); ``` However, we are over-aggressive and we incorrectly diagnose cases such as: ``` void foo(std::tuple<int const&, int const&> const&); foo(std::make_tuple(42, 42)); ``` This patch fixes the incorrectly diagnosed cases, as well as converting the diagnostic to use the newly added Clang trait `__reference_binds_to_temporary`. The new trait allows us to diagnose cases we previously couldn't such as: ``` std::tuple<int, const std::string&> t(42, "abc"); ``` Reviewers: rsmith, mclow.lists Reviewed By: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D41977 llvm-svn: 323380
* [libcxx] [test] Fix MSVC warnings, null pointer deref.Stephan T. Lavavej2017-12-131-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | test/std/algorithms/alg.modifying.operations/alg.generate/generate_n.pass.cpp Silence MSVC warning C4244. This is expected when passing floating-point values for size. test/std/utilities/template.bitset/bitset.members/to_ullong.pass.cpp test/std/utilities/template.bitset/bitset.members/to_ulong.pass.cpp Avoid MSVC "warning C4293: '<<': shift count negative or too big, undefined behavior". MSVC sees (1ULL << N) and warns - being guarded by const bool canFit is insufficient. A small change to the code avoids the warning without the need for a pragma. Remove a spurious printf() declaration from to_ullong.pass.cpp. Change ULL to UL in to_ulong.pass.cpp. The ULL suffix was probably copy-pasted. test/std/utilities/tuple/tuple.general/ignore.pass.cpp Use LIBCPP_STATIC_ASSERT for consistency with other files. test/support/container_test_types.h Fix a null pointer dereference, found by MSVC /analyze warning C6011 "Dereferencing NULL pointer 'm_expected_args'." Fixes D41030. llvm-svn: 320535
* Add another test_macros.h include I missed to tuple.by.type.pass.cppBilly Robert O'Neal III2017-11-221-0/+1
| | | | llvm-svn: 318830
* Change (void) casts to TEST_IGNORE_NODISCARD, as requested by Eric. Reviewed ↵Billy Robert O'Neal III2017-11-211-4/+4
| | | | | | as https://reviews.llvm.org/D40065 llvm-svn: 318804
* Placate unused variable warnings uncovered by improvements to clang's ↵Benjamin Kramer2017-10-143-0/+5
| | | | | | -Wunused-variable llvm-svn: 315809
* Add C++17 explicit deduction guides to std::pair.Eric Fiselier2017-10-041-3/+4
| | | | | | | This patch adds the newly standardized deduction guides for std::pair, allowing it to work class template deduction. llvm-svn: 314864
* [libcxx] [test] Fix URLs in comments and make them HTTPS. NFC.Stephan T. Lavavej2017-08-051-1/+1
| | | | llvm-svn: 310156
* [libcxx] [test] Fix -Wmismatched-tags in ↵Stephan T. Lavavej2017-06-201-2/+4
| | | | | | | | | | | | 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. llvm-svn: 305854
* [libcxx] [test] Strip trailing whitespace. NFC.Stephan T. Lavavej2017-06-201-1/+1
| | | | llvm-svn: 305848
* [libcxx] [test] Add more tests to tuple_size_structured_bindings.pass.cpp ↵Stephan T. Lavavej2017-06-201-6/+16
| | | | | | | | | | | | | | | | | | | 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. llvm-svn: 305843
* XFAIL tuple deduction guide test on GCCEric Fiselier2017-06-081-0/+5
| | | | llvm-svn: 304969
* Add tests for class template deduction on std::tuple.Eric Fiselier2017-06-081-0/+150
| | | | llvm-svn: 304967
* Fix or move tests with non-standard assumptionsEric Fiselier2017-05-121-46/+0
| | | | llvm-svn: 302862
* Mark LWG#2796 as complete. No functionality change; we had tests that ↵Marshall Clow2017-05-111-0/+4
| | | | | | covered it already. Just added comments to the tests llvm-svn: 302798
* Cleanup _LIBCPP_HAS_NO_<c++11-feature> in the utilities libraryEric Fiselier2017-04-191-2/+0
| | | | llvm-svn: 300635
* Update all bug URL's to point to https://bugs.llvm.org/...Eric Fiselier2017-02-172-2/+2
| | | | llvm-svn: 295434
* Implement LWG 2773 - std::ignore should be constexpr.Eric Fiselier2017-02-062-0/+77
| | | | | | | | In addition to the PR for LWG 2773 this patch also ensures that each of std::ignores constructors or assignment operators are constexpr. llvm-svn: 294165
* [libcxx] [test] Fix comment typos.Stephan T. Lavavej2017-02-052-2/+2
| | | | | | No functional change, no code review. llvm-svn: 294160
* Revert previous cleanup; I got too agressive removing #ifdefsMarshall Clow2017-01-231-0/+2
| | | | llvm-svn: 292809
* Removed some un-needed ifdefsMarshall Clow2017-01-231-2/+0
| | | | llvm-svn: 292806
* [libcxx] [test] Fix comment typos, strip trailing whitespace.Stephan T. Lavavej2017-01-182-4/+4
| | | | | | No functional change, no code review. llvm-svn: 292434
* Fix XPASS buildbot failure related to structured bindingsEric Fiselier2017-01-051-1/+1
| | | | | | | | | | | The test was previously set to XFAIL if __cpp_structured_bindings wasn't defined. However there are Clang 4.0 versions which do not define this macro but do provide structured bindings, which causes the test to pass unexpectedly. This patch changes the XFAIL to an UNSUPPORTED. llvm-svn: 291060
* Fix verify test on 32 bit systemsEric Fiselier2017-01-041-1/+1
| | | | llvm-svn: 291031
OpenPOWER on IntegriCloud