Commit Graph

70 Commits

Author SHA1 Message Date
Marshall Clow
3870a97d86 Fix PR39619 - iterator_traits isn't SFINAE-friendly enough. Thanks to Eric for the report
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@346738 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-13 05:33:31 +00:00
Stephan T. Lavavej
8663c51b30 [libcxx] [test] Fix whitespace, NFC.
Strip trailing whitespace and untabify.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@331576 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-05 01:40:27 +00:00
Marshall Clow
a5996e8dc9 Move old test into test/libcxx, and implement new version of test for ostreambuf_iterator::failed. Fixes PR#37245. Thanks to Billy O'Neill for the bug report.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@330955 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-26 16:16:45 +00:00
Stephan T. Lavavej
bf3a3685cf [libcxx] [test] Use TEST_COMPILER_C1XX.
Also TEST_COMPILER_CLANG in one place. (More could be changed.)

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@329977 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-12 23:56:17 +00:00
Marshall Clow
4bbcce7ef8 Add tests to make sure that <string_view> provides std::size/data/empty in C++17 mode. This is LWG#3009, coming up for a vote in JAX - but we already do it, just don't have tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@323719 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-30 00:47:43 +00:00
Roger Ferrer Ibanez
4a3242f1dc [libcxx] Define istream_iterator equality comparison operators out-of-line
Currently libc++ defines operator== and operator!= as friend functions in the
definition of the istream_iterator class template. Such definition has a subtle
difference from an out-of-line definition required by the C++ Standard: these
functions can only be found by argument-dependent lookup, but not by qualified
lookup.

This patch changes the definition, so that it conforms to the C++ Standard and
adds a check involving qualified lookup to the test suite.

Patch contributed by Mikhail Maltsev.

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



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@320363 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-11 13:54:58 +00:00
Billy Robert O'Neal III
7e250fcdc1 Change (void) casts to TEST_IGNORE_NODISCARD, as requested by Eric. Reviewed as https://reviews.llvm.org/D40065
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@318804 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-21 21:37:26 +00:00
Marshall Clow
f1729d90b3 More of P0600 - '[[nodiscard]] in the Library' mark empty() as nodiscard in string, string_view, and the free function std::empty(). Removed tabs from <string_view>, which is why the diff is so big.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@318328 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-15 20:02:27 +00:00
Marshall Clow
37b5a6b495 Clean up the tests for free data(), size() and empty()
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@318313 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-15 17:47:09 +00:00
Billy Robert O'Neal III
9ae62c79cc Tolerate [[nodiscard]] annotations in the STL. Reviewed as https://reviews.llvm.org/D39033
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@318276 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-15 07:40:37 +00:00
Marshall Clow
8437dbd021 Another test for LWG2952
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@318126 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-14 01:18:36 +00:00
Marshall Clow
e1cfe7a7f6 Implement LWG2952: iterator_traits should work for pointers to cv T
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@318119 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-14 00:03:10 +00:00
Eric Fiselier
6efb1c19a7 Change test suite to support c++17 dialect flag instead of c++1z.
This patch changes the test suite to attempt and prefer -std=c++17 over
-std=c++1z. It also fixes the REQUIRES and UNSUPPORTED lit markers
to refer to c++17 over c++1z.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@317610 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-07 20:20:58 +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
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
a5acfb93d4 [libcxx] [test] Consistently list "c++98, c++03" in chronological order. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@310155 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-05 00:44:19 +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
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
Rachel Craik
24047fd4a7 Remove addtional parameters in function std::next() and std::prev()
Creating a function pointer with proper parameters pointing to std::next() or std::prev() should work.
This change moves the invented paramater for enable_if over to the return type to resolve this QoI issue.

Patch by Jason Liu.

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


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@308932 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-24 22:17:05 +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
Marshall Clow
a9197bd465 Implement LWG#2790: Remove istreambuf_iterator::operator->. It never did anything useful.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@303675 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-23 18:55:32 +00:00
Marshall Clow
9e6b540dad Make next/prev/advance/distance operations on iterators be constexpr. I missed this when I implemented the rest of P0031R0
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@303281 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-17 18:51:36 +00:00
Stephan T. Lavavej
ff9b14a34a [libcxx] [test] Be compatible with LWG 2438 "std::iterator inheritance shouldn't be mandated".
In C++17, these iterators are allowed but not required
to inherit from the deprecated std::iterator base class.

Fixes D32727.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@302318 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-05 23:01:38 +00:00
Eric Fiselier
f4dfb45247 Clean up more usages of _LIBCPP_HAS_NO_RVALUE_REFERENCES
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@296854 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-03 03:43:25 +00:00
Mehdi Amini
bd89190e69 Recommit r296712: "Fix Apple-specific XFAIL directive in libc++ test"
The test is passing with c++11 and c++14 but not c++1z on this
particular version of the compiler. Try to use lit boolean condition
to satisfy this constaint.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@296725 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-02 02:01:11 +00:00
Mehdi Amini
c10e963f3d Revert "Fix Apple-specific XFAIL directive in libc++ test"
This reverts commit r296712. It broke our bot.

It turns out that the test is passing with c++11 and c++14 but
not c++1z on this particular version of the compiler. Since one
job is defaulting to c++1z and the other is testing all config I'm
not sure how to fix this...

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@296724 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-02 01:57:40 +00:00
Mehdi Amini
5876a625ba Fix Apple-specific XFAIL directive in libc++ test
This tests is failing in XCode 7.0. But Xcode 7.3 that shipped
an updated clang has this test passing. This is fixing green dragon
which runs this configuration.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@296712 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-01 23:45:03 +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
Stephan T. Lavavej
16e2ba19df [libcxx] [test] Fix comment typos, strip trailing whitespace.
No functional change, no code review.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292434 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-18 20:10:25 +00:00
Stephan T. Lavavej
51eb1be9ec [libcxx] [test] Strip trailing whitespace. NFC, no code review.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291322 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-07 01:12:15 +00:00
Marshall Clow
e22af6b758 Implement the last bit of P0031: 'A Proposal to Add Constexpr Modifiers to reverse_iterator, move_iterator, array and Range Access' for C++17
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290976 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-04 17:58:17 +00:00
Eric Fiselier
10dd69eaf1 Fix unused warning which only triggers in C++11
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290475 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-24 01:12:28 +00:00
Eric Fiselier
0e5ebbc77c Fix unused parameters and variables
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290459 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 23:37:52 +00:00
Eric Fiselier
4a435415ad XFAIL test for more apple-clang versions
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@289767 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-15 05:41:07 +00:00
Eric Fiselier
a793c18bae XFAIL test on apple-clang-7.0
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@289716 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-14 21:44:08 +00:00
Eric Fiselier
6d95982406 Recommit r286884: P0503R0, adopted in Issaquah, rewords some requirements on nullptr_t and istream_iterator.
No code changes were needed, but I updated a few tests.
Also resolved P0509 and P0521, which required no changes to the library or tests.

This patch was reverted due to llvm.org/PR31016. There is a bug in Clang 3.7
which causes default.pass.cpp to fails. That test is now marked as XFAIL for that
clang version.

This patch was originally authored by Marshall Clow.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@289708 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-14 21:22:48 +00:00
Stephan T. Lavavej
3e541a6172 [libcxx] [test] Fix MSVC warning C4244 "conversion from 'X' to 'Y', possible loss of data", part 7/7.
test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp
Add static_cast<char> because basic_istream::get() returns int_type (N4606 27.7.2.3 [istream.unformatted]/4).

test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp
Add static_cast<char> because toupper() returns int (C11 7.4.2.2/1).

test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.ops/assign_t.pass.cpp
This test is intentionally writing doubles to ostream_iterator<int>.
It's silencing -Wliteral-conversion for Clang, so I'm adding C4244 silencing for MSVC.

test/std/language.support/support.limits/limits/numeric.limits.members/infinity.pass.cpp
Given `extern float zero;`, the expression `1./zero` has type double, which emits a truncation warning
when being passed to test<float>() taking float. The fix is to say `1.f/zero` which has type float.

test/std/numerics/complex.number/cmplx.over/arg.pass.cpp
test/std/numerics/complex.number/cmplx.over/norm.pass.cpp
These tests were constructing std::complex<double>(x, 0), emitting truncation warnings when x is long long.
Saying static_cast<double>(x) avoids this.

test/std/numerics/rand/rand.eng/rand.eng.lcong/seed_result_type.pass.cpp
This was using `int s` to construct and seed a linear_congruential_engine<T, stuff>, where T is
unsigned short/unsigned int/unsigned long/unsigned long long. That emits a truncation warning in the
unsigned short case. Because the range [0, 20) is tiny and we aren't doing anything else with the index,
we can just iterate with `T s`.

test/std/re/re.traits/value.pass.cpp
regex_traits<wchar_t>::value()'s first parameter is wchar_t (N4606 28.7 [re.traits]/13). This loop is
using int to iterate through ['g', 0xFFFF), emitting a truncation warning from int to wchar_t
(which is 16-bit for some of us). Because the bound is exclusive, we can just iterate with wchar_t.

test/std/strings/basic.string/string.cons/size_char_alloc.pass.cpp
This test is a little strange. It's trying to verify that basic_string's (InIt, InIt) range constructor
isn't confused by "N copies of C" when N and C have the same integral type. To do this, it was
testing (100, 65), but that eventually emits truncation warnings from int to char. There's a simple way
to avoid this - passing (static_cast<char>(100), static_cast<char>(65)) also exercises the disambiguation.
(And 100 is representable even when char has a signed range.)

test/std/strings/string.view/string.view.hash/string_view.pass.cpp
Add static_cast<char_type> because `'0' + i` has type int.

test/std/utilities/function.objects/bind/func.bind/func.bind.bind/nested.pass.cpp
What's more horrible than nested bind()? pow() overloads! This operator()(T a, T b) was assuming that
std::pow(a, b) can be returned as T. (In this case, T is int.) However, N4606 26.9.1 [cmath.syn]/2
says that pow(int, int) returns double, so this was truncating double to int.
Adding static_cast<T> silences this.

test/std/utilities/function.objects/unord.hash/integral.pass.cpp
This was iterating `for (int i = 0; i <= 5; ++i)` and constructing `T t(i);` but that's truncating
when T is short. (And super truncating when T is bool.) Adding static_cast<T> silences this.

test/std/utilities/utility/exchange/exchange.pass.cpp
First, this was exchanging 67.2 into an int, but that's inherently truncating.
Changing this to static_cast<short>(67) avoids the truncation while preserving the
"what if T and U are different" test coverage.
Second, this was exchanging {} with the explicit type float into an int, and that's also
inherently truncating. Specifying short is just as good.

test/std/utilities/utility/pairs/pairs.spec/make_pair.pass.cpp
Add static_cast<short>. Note that this affects template argument deduction for make_pair(),
better fulfilling the test's intent. For example, this was saying
`typedef std::pair<int, short> P1; P1 p1 = std::make_pair(3, 4);` but that was asking
make_pair() to return pair<int, int>, which was then being converted to pair<int, short>.
(pair's converting constructors are tested elsewhere.)
Now, std::make_pair(3, static_cast<short>(4)) actually returns pair<int, short>.
(There's still a conversion from pair<nullptr_t, short> to pair<unique_ptr<int>, short>.)

Fixes D27544.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@289111 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-08 21:38:57 +00:00
Eric Fiselier
efc48515b4 Enable warnings by default for C++ >= 11 and fix -Wshadow occurances
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@288557 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-03 00:27:13 +00:00
Stephan T. Lavavej
e33c0b01f8 [libcxx] [test] D27027: Strip trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@287829 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-23 22:03:28 +00:00
Vedant Kumar
e3cb222597 Revert "P0503R0, adopted in Issaquah, rewords some requirements on nullptr_t and istream_iterator. No code changes were needed, but I updated a few tests. Also resolved P0509 and P0521, which required no changes to the library or tests."
This reverts commit r286884, because it breaks the Xcode 7 builders:

  http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-expensive/1583

Here is a PR that tracks the issue:
https://llvm.org/bugs/show_bug.cgi?id=31016

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@287004 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-15 18:48:36 +00:00
Marshall Clow
506f7fcee5 P0503R0, adopted in Issaquah, rewords some requirements on nullptr_t and istream_iterator. No code changes were needed, but I updated a few tests. Also resolved P0509 and P0521, which required no changes to the library or tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@286884 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-14 20:41:17 +00:00
Stephan T. Lavavej
e619862dbf [libcxx] [test] Replace _LIBCPP_STD_VER with TEST_STD_VER.
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
2016-11-04 20:26:59 +00:00
Marshall Clow
f333beee2c Implement another part of P0031; adding constexpr to move_iterator
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@285818 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-02 15:30:26 +00:00
Marshall Clow
464abc8aee Adding a missing constexpr test for reverse_iterator operator[].
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284731 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-20 14:57:34 +00:00
Marshall Clow
4414a6a911 Implement constexpr support for reverse_iterator. Reviewed as https://reviews.llvm.org/D25534
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284602 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-19 15:12:50 +00:00
Marshall Clow
8be2c5dd9e Add tests for LWG2544. We already implement this; just adding tests to make sure that we keep doing it.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283749 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-10 14:10:45 +00:00
Asiri Rathnayake
6e3bce5f6c [libcxx] Add missing c++98 xfail. NFC.
This is the only test failing in c++98 mode at the moment.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@281731 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-16 14:32:19 +00:00
Marshall Clow
6efc20f541 Mark test as XFAIL for C++03, rather than providing a dummy pass.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@280605 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-04 00:37:06 +00:00
Marshall Clow
02e94f8095 std:: quailfy the calls for cend/crend/cbegin/cend. Fixes bug 28927.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@278282 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 20:04:46 +00:00