summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/utilities/meta
Commit message (Collapse)AuthorAgeFilesLines
* [libcxx] [test] Fix valarray UB and MSVC warnings.Stephan T. Lavavej2019-12-121-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [libcxx] [test] Calling min and max on an empty valarray is UB. libcxx/test/std/numerics/numarray/template.valarray/valarray.members/min.pass.cpp libcxx/test/std/numerics/numarray/template.valarray/valarray.members/max.pass.cpp The calls `v1.min();` and `v1.max();` were emitting nodiscard warnings with MSVC's STL. Upon closer inspection, these calls were triggering undefined behavior. N4842 [valarray.members] says: "T min() const; 8 Preconditions: size() > 0 is true. T max() const; 10 Preconditions: size() > 0 is true." As these tests already provide coverage for non-empty valarrays (immediately above), I've simply deleted the code for empty valarrays. [libcxx] [test] Add macros to msvc_stdlib_force_include.h (NFC). libcxx/test/support/msvc_stdlib_force_include.h These macros are being used by: libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp Defining them to nothing allows that test to pass. [libcxx] [test] Silence MSVC warning C5063 for is_constant_evaluated (NFC). libcxx/test/std/utilities/meta/meta.const.eval/is_constant_evaluated.pass.cpp This test is intentionally writing code that MSVC intentionally warns about, so the warning should be silenced. Additionally, comment an endif for clarity. [libcxx] [test] Silence MSVC warning C4127 (NFC). libcxx/test/support/charconv_test_helpers.h MSVC avoids emitting this warning when it sees a single constexpr value being tested, but this condition is a mix of compile-time and run-time. Using push-disable-pop is the least intrusive way to silence this. [libcxx] [test] Silence MSVC truncation warning (NFC). libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp This test is intentionally truncating float to int, which MSVC intentionally warns about, so push-disable-pop is necessary. [libcxx] [test] Avoid truncation warnings in erase_if tests (NFC). libcxx/test/std/containers/associative/map/map.erasure/erase_if.pass.cpp libcxx/test/std/containers/associative/multimap/multimap.erasure/erase_if.pass.cpp libcxx/test/std/containers/unord/unord.map/erase_if.pass.cpp libcxx/test/std/containers/unord/unord.multimap/erase_if.pass.cpp These tests use maps with `short` keys and values, emitting MSVC truncation warnings from `int`. Adding `static_cast` to `key_type` and `mapped_type` avoids these warnings. As these tests require C++20 mode (or newer), for brevity I've changed the multimap tests to use emplace to initialize the test data. This has no effect on the erase_if testing.
* [libc++] Cleanup and enable multiple warnings.Eric Fiselier2019-12-122-0/+7
| | | | | | | | | | Too many warnings are being disabled too quickly. Warnings are important to keeping libc++ correct. This patch re-enables two warnings: -Wconstant-evaluated and -Wdeprecated-copy. In future, all warnings disabled for the test suite should require an attached bug. The bug should state the plan for re-enabling that warning, or a strong case why it should remain disabled.
* [libc++] Add test and remove workaround for PR13592Louis Dionne2019-10-301-3/+9
| | | | | | | | PR13592 was caused by a problem in how to compiler implemented the __is_convertible_to intrinsic. That problem, reported as PR13591, was fixed back in 2012. We don't support such old versions of Clang anyway, so we don't need the library workaround that had been added to solve PR13592 (while waiting for the compiler fix).
* [NFC] Strip trailing whitespace from libc++Louis Dionne2019-10-232-2/+2
|
* [libc++][NFC] Remove excess trailing newlines from most filesCasey Carter2019-10-231-1/+0
| | | | Testing git commit access.
* [libcxx][test][NFC] Fix comment typos.Stephan T. Lavavej2019-10-222-2/+2
| | | | (Testing git commit access.)
* P1152R4: Fix deprecation warnings in libc++ testsuite and in uses of ↵Richard Smith2019-10-191-0/+5
| | | | | | | | | | | | | | | | is_invocable that would internally conjure up a deprecated function type. Summary: The implementation of P1152R4 in Clang has resulted in some deprecation warnings appearing in the libc++ and libc++abi test suite. Fix or suppress these warnings. Reviewers: mclow.lists, EricWF Subscribers: christof, ldionne, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D68879 llvm-svn: 375307
* [libc++][test] Miscellaneous MSVC cleanupsCasey Carter2019-10-091-1/+3
| | | | | | | | | | | | * Silence unused-local-typedef warnings: `map.cons/assign_initializer_list.pass.cpp` (and the `set.cons` variant) uses a local typedef only within `LIBCPP_ASSERT`s, so clang diagnoses it as unused when testing non-libc++. * Add missing include: `c.math/abs.pass.cpp` uses `std::numeric_limits` but failed to `#include <limits>`. * Don't test non-type: A "recent" change to `meta.trans.other/underlying_type.pass.cpp` unconditionally tests the type `F` which is conditionally defined. * Use `hash<long long>` instead of `hash<short>` with `int` in `unordered_meow` deduction guide tests to avoid truncation warnings. * Convert `3.14` explicitly in `midpoint.float.pass` since MSVC incorrectly diagnoses `float meow = 3.14;` as truncating. Differential Revision: https://reviews.llvm.org/D68681 llvm-svn: 374248
* [libc++] Purge mentions of GCC 4 from the test suiteLouis Dionne2019-09-256-11/+1
| | | | | | | | | 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-1/+11
| | | | | | | | | | | | 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-246-11/+1
| | | | | | | We don't support GCC 4 and older according to the documentation, so we should pretend it doesn't exist. llvm-svn: 372787
* Fix various test failures with GCCEric Fiselier2019-09-131-2/+6
| | | | llvm-svn: 371880
* [libc++] Precise XFAIL for AppleClang 11Louis Dionne2019-08-201-1/+1
| | | | | | This test doesn't fail on all patch levels of AppleClang 11 llvm-svn: 369420
* [libc++] Add XFAIL for is_base_of test on AppleClang 11Louis Dionne2019-08-191-2/+2
| | | | llvm-svn: 369280
* Implement most of P1612R1: Relocate endian. Moves the std::endian ↵Marshall Clow2019-07-231-48/+0
| | | | | | functionality from 'type-traits' to 'bit'. No other change. The reason that this is 'partial' is that P1621 also recommends a feature-test macro, but I don't have the value for that one yet. In a month or so, I'll add that llvm-svn: 366776
* Implement P0340R3: Make 'underlying_type' SFINAE-friendly. Reviewed as ↵Marshall Clow2019-06-212-20/+106
| | | | | | https://reviews.llvm.org/D63574 llvm-svn: 364094
* Use rvalue references throughout the is_constructible traits.Eric Fiselier2019-06-213-6/+3
| | | | llvm-svn: 364065
* Enable aligned_union in C++03Eric Fiselier2019-06-211-2/+0
| | | | llvm-svn: 364058
* Get is_convertible tests passing in C++03 (except the fallback).Eric Fiselier2019-06-212-8/+3
| | | | llvm-svn: 364057
* Make rvalue metaprogramming traits work in C++03.Eric Fiselier2019-06-218-19/+0
| | | | | | The next step is to get move and forward working in C++03. llvm-svn: 364053
* [libc++] Re-apply XFAIL to is_base_of test that was inadvertently revertedLouis Dionne2019-06-181-4/+5
| | | | llvm-svn: 363689
* [libc++] Revert the addition of map/multimap CTADLouis Dionne2019-06-181-2/+1
| | | | | | | | | | | | | This was found to be broken on Clang trunk. This is a revert of the following commits (the subsequent commits added XFAILs to the tests that were missing from the original submission): r362986: Implement deduction guides for map/multimap. r363014: Add some XFAILs r363097: Add more XFAILs r363197: Add even more XFAILs llvm-svn: 363688
* XFAIL a couple of tests on apple-clang-9.1, which is a compiler that I ↵Marshall Clow2019-06-111-1/+2
| | | | | | didn't know existed llvm-svn: 363097
* Add a test for is_base_of and incomplete types. Because this trait uses a ↵Marshall Clow2019-06-111-0/+92
| | | | | | compiler intrinsic which was broken in many clangs, have lots of XFAILs. llvm-svn: 363029
* Add include for 'test_macros.h' to all the tests that were missing them. ↵Marshall Clow2019-05-3121-0/+42
| | | | | | Thanks to Zoe for the (big, but simple) patch. NFC intended. llvm-svn: 362252
* Improve the test coverage for std::is_base_ofMarshall Clow2019-05-161-0/+15
| | | | llvm-svn: 360911
* Mark is_trivially_destructible as unsupported with apple-clang-9Nico Weber2019-05-031-0/+1
| | | | | | See discussion on https://reviews.llvm.org/D48292 llvm-svn: 359907
* Support overaligned types in `aligned_storage`.Eric Fiselier2019-04-301-0/+8
| | | | | | | | | | | | | | | | | Summary: The current implementation of aligned storage was written before we had `alignas`, so it used a list of builtin types to force the alignment. But this doesn't work overaligned requests. This patch adds a fallback case supporting over-alignment. It only affects case that were previously ill-formed. Reviewers: rsmith, ldionne, dlj, mclow.lists Reviewed By: mclow.lists Subscribers: mclow.lists, dexonsmith, libcxx-commits Differential Revision: https://reviews.llvm.org/D61301 llvm-svn: 359596
* Use modern type trait implementations when available.Richard Smith2019-04-251-0/+6
| | | | | | | | | | | | | | Teach libcxx to stop using various deprecated __has_* type traits, in favor of the ("modern", C++11 era) __is_* type traits. This is mostly just a simplification, but fixes at least one bug: _Atomic T should be considered trivially-destructible, but is not considered to be POD by Clang, and __has_trivial_destructor is specified in the GCC documentation as returning false for non-POD non-class types. Differential Revision: https://reviews.llvm.org/D48292 llvm-svn: 359159
* Add std::is_constant_evaluated.Eric Fiselier2019-04-242-0/+79
| | | | | | | | | Clang recently added __builtin_is_constant_evaluated() and GCC 9.0 has it as well. This patch adds support for it in libc++. llvm-svn: 359119
* [libc++][NFC] Rename test file according to the libc++ conventionLouis Dionne2019-04-031-0/+58
| | | | llvm-svn: 357588
* Make common_type's implementation common Eric Fiselier2019-03-311-77/+98
| | | | | | | | | | | | | | | | | | | Summary: Currently the C++03 implementation of common_type has much different behavior than the C++11 one. This causes bugs, including inside `<chrono>`. This patch unifies the two implementations as best it can. The more code they share, the less their behavior can diverge. Reviewers: mclow.lists, ldionne, sbenza Reviewed By: mclow.lists, ldionne Subscribers: libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D59678 llvm-svn: 357370
* Reworked all the utilities/meta tests to use ASSERT_SAME_TYPE instead of ↵Marshall Clow2019-03-2827-153/+120
| | | | | | 'static_assert( is_same<'. Much easier to read. I left two tests alone: is_same.pass.cpp, which should call 'is_same' directly, and common_type.pass.cpp, which Eric is working on. NFC intended llvm-svn: 357146
* Implement P1357: Traits for [Un]bounded Arrays; adopted in KonaMarshall Clow2019-02-262-0/+142
| | | | llvm-svn: 354891
* [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-04143-144/+430
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix PR40495 - is_invokable_v<void> does not compileEric Fiselier2019-01-292-182/+356
| | | | | | | | | | | The meta-programming that attempted to form the invoke call expression was not in a SFINAE context. This made it a hard error to provide non-referencable types like 'void' or 'void (...) const'. This patch fixes the error by checking the validity of the call expression within a SFINAE context. llvm-svn: 352522
* Update more file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-19144-576/+432
| | | | | | | | | | | | | | | | | | 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
* Move internal usages of `alignof`/`__alignof` to use `_LIBCPP_ALIGNOF`. Eric Fiselier2019-01-162-7/+10
| | | | | | | | | | | | | | | | | | | | | Summary: Starting in Clang 8.0 and GCC 8.0, `alignof` and `__alignof` return different values in same cases. Specifically `alignof` and `_Alignof` return the minimum alignment for a type, where as `__alignof` returns the preferred alignment. libc++ currently uses `__alignof` but means to use `alignof`. See llvm.org/PR39713 This patch introduces the macro `_LIBCPP_ALIGNOF` so we can control which spelling gets used. This patch does not introduce any ABI guard to provide the old behavior with newer compilers. However, if we decide that is needed, this patch makes it trivial to implement. I think we should commit this change immediately, and decide what we want to do about the ABI afterwards. Reviewers: ldionne, EricWF Reviewed By: ldionne, EricWF Subscribers: jyknight, christof, libcxx-commits Differential Revision: https://reviews.llvm.org/D54814 llvm-svn: 351289
* Second part of P0482 - char8_t. Reviewed as https://reviews.llvm.org/D55308Marshall Clow2018-12-111-1/+1
| | | | llvm-svn: 348828
* First part of P0482 - Establish that char8_t is an integral type, and that ↵Marshall Clow2018-11-291-0/+3
| | | | | | numeric_limits<char8_t> is valid and sane. (second try) llvm-svn: 347930
* Revert commit r347904 because it broke older compilersMarshall Clow2018-11-291-3/+0
| | | | llvm-svn: 347908
* First part of P0482 - Establish that char8_t is an integral type, and that ↵Marshall Clow2018-11-291-0/+3
| | | | | | numeric_limits<char8_t> is valid and sane. llvm-svn: 347904
* Revert "Move internal usages of `alignof`/`__alignof` to use ↵Eric Fiselier2018-11-281-3/+6
| | | | | | | | | | | `_LIBCPP_ALIGNOF`. " This reverts commit 087f065cb0c7463f521a62599884493aaee2ea12. The tests were failing on 32 bit builds, and I don't have time to clean them up right now. I'll recommit tomorrow with fixed tests. llvm-svn: 347816
* Move internal usages of `alignof`/`__alignof` to use `_LIBCPP_ALIGNOF`. Eric Fiselier2018-11-281-6/+3
| | | | | | | | | | | | | | | | | | | | | Summary: Starting in Clang 8.0 and GCC 8.0, `alignof` and `__alignof` return different values in same cases. Specifically `alignof` and `_Alignof` return the minimum alignment for a type, where as `__alignof` returns the preferred alignment. libc++ currently uses `__alignof` but means to use `alignof`. See llvm.org/PR39713 This patch introduces the macro `_LIBCPP_ALIGNOF` so we can control which spelling gets used. This patch does not introduce any ABI guard to provide the old behavior with newer compilers. However, if we decide that is needed, this patch makes it trivial to implement. I think we should commit this change immediately, and decide what we want to do about the ABI afterwards. Reviewers: ldionne, EricWF Reviewed By: EricWF Subscribers: christof, libcxx-commits Differential Revision: https://reviews.llvm.org/D54814 llvm-svn: 347787
* Get tests compiling with -Wunused-local-typedefEric Fiselier2018-11-151-1/+0
| | | | llvm-svn: 346914
* Add a test that shows what happens with throwing destructors. NFC.Marshall Clow2018-10-111-0/+11
| | | | llvm-svn: 344220
* Implement P0887: The identity metafunctionMarshall Clow2018-08-021-0/+40
| | | | llvm-svn: 338666
* [test] two small cleanups:Casey Carter2018-07-092-5/+2
| | | | | | | | * Remove unused type from is_assignable.pass.cpp * Don't specialize `common_type<::X<float>>` in common_type.pass.cpp, which violates the requirements of [meta.trans.other]/5 llvm-svn: 336618
* Update XFAIL so apple-clang-9.0 is the last version not implementing Core 2094.Volodymyr Sapsai2018-05-141-1/+1
| | | | | | The test is passing with apple-clang-9.1. rdar://problem/40222003 llvm-svn: 332282
OpenPOWER on IntegriCloud