Commit Graph

11 Commits

Author SHA1 Message Date
Casey Carter
d8b79a0d07 [libc++][test] Fix noexcept assertions in variant's get tests
All constant expressions are non-potentially-throwing in C++14, but that is *not* the case in C++17. Change these tests of the `variant`-flavored overloads of `std::get` to expect the correct behavior when the compiler is not GCC or is GCC 9+.

Credit to Jonathan Wakely for providing an improved version of my initial change that validates the incorrect behavior on GCC < 9 as well as validating the correct behavior on other compilers.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@359220 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-25 18:36:29 +00:00
Chandler Carruth
7c3769df62 Update more file headers across all of the LLVM projects in the monorepo
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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@351648 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-19 10:56:40 +00:00
Casey Carter
91d004da6c [test] Remove workaround for C1XX empty parameter pack bug
Was VSO#109062. This bug was filed *4 years ago*. I submitted a workaround to enable the scoped_allocator_adaptor tests to pass. Bug fixed a week and a half later. This was either a waste of my time, or I've discovered that libc++ has magical bugfix-inducing powers. My money's on the latter.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@304730 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-05 19:59:17 +00:00
Casey Carter
a42191c839 [test] Remove workaround for C1XX conversion-to-nullptr bug
VSO#391542 "Types can't be convertible to nullptr_t"

Also put internal bug numbers on the workarounds in test_workarounds.h for correlation.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@303889 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-25 17:42:21 +00:00
Casey Carter
8b55cce1c8 [test] Workaround C1XX bug in uses_allocator_types.hpp
VSO#109062 "Explicit template argument specification with empty template parameter pack expansion does not imply further empty pack expansion"

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@303888 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-25 17:42:17 +00:00
Casey Carter
f0346a5663 [test] support machinery changes for EDG & C1XX /Za
This change works around a couple of bugs:

1. EDG doesn't like explicit constexpr in a derived class. This program:

  struct Base {};
  struct Derived : Base {
      constexpr Derived() = default;
  };

  triggers "error: defaulted default constructor cannot be constexpr."

2. C1XX with /Za has no idea which constructor needs to be valid for copy elision.

The change also conditionally disables parts of the msvc_stdlib_force_include.hpp header that conflict with external configuration when _LIBCXX_IN_DEVCRT is defined.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@302707 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-10 19:10:49 +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
a4fd0c9d61 Overhaul unique_ptr - Implement LWG 2801, 2905, 2520.
This patch overhauls both specializations of unique_ptr while implementing
the following LWG issues:

* LWG 2801 - This issue constrains unique_ptr's constructors when the deleter type
  is not default constructible. Additionally it adds SFINAE conditions
  to unique_ptr<T[]>::unique_ptr(Up).

* LWG 2905 - This issue reworks the unique_ptr(pointer, /* see below */ deleter)
  constructors so that they correctly SFINAE when the deleter argument cannot
  be used to construct the stored deleter.

* LWG 2520 - This issue fixes initializing unique_ptr<T[]> from nullptr.
  Libc++ had previously implemented this issue, but the suggested resolution
  still broke initialization from NULL. This patch re-works the
  unique_ptr<T[]>(Up, deleter) overloads so that they accept NULL as well
  as nullptr.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300406 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-16 01:51:04 +00:00
Eric Fiselier
81f58e5052 Rewrite and cleanup unique_ptr tests.
This patch almost entirely rewrites the unique_ptr tests. There are a couple
of reasons for this:

A) Most of the *.fail.cpp tests were either incorrect or could be better written
  as a *.pass.cpp test that uses <type_traits> to check if certain operations
  are valid (Ex. Using static_assert(!std::is_copy_constructible_v<T>) instead
  of writing a failure test).

B) [unique.ptr.runtime] has very poor test coverage. Many of the constructors
  and assignment operators have to tests at all. The special members that have
  tests have very few test cases and are typically way out of date.

C) The tests for [unique.ptr.single] and [unique.ptr.runtime] are largely
  duplicates of each other. This means common requirements have two different
  sets of tests in two different test files. This makes the tests harder to
  maintain than if there was a single copy.

To address (A) this patch changes almost all of the *.fail.cpp tests into
.pass.cpp tests using type traits; Allowing the *.fail.cpp tests to be removed.

The address (B) and (C) the tests for [unique.ptr.single] and [unique.ptr.runtime]
have been combined into a single directory, allowing both specializations to share
common tests. Tests specific to the single/runtime specializations are given the
suffix "*.single.pass.cpp" or "*.runtime.pass.cpp".

Finally the unique.ptr test have been moved into the correct directory according
to the standard. Specifically they have been removed from "utilities/memory" into
"utilities/smartptr".

PS. This patch also adds newly written tests for upcoming unique_ptr changes/fixes.
However since these tests don't currently pass they are guarded by the macro
TEST_WORKAROUND_UPCOMING_UNIQUE_PTR_CHANGES. This allows other STL's to validate
the tests before libc++ implements the changes. The relevant libc++ changes should
land in the next week.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@300388 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-15 05:28:06 +00:00
Eric Fiselier
03096267d6 Address post-commit review comments regarding test_workarounds.h
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298566 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-23 00:48:59 +00:00
Eric Fiselier
0da4cb892b [libc++] Work around C1XX bug which breaks poisoned hash tests.
Summary: This is my attempt to work around the C1XX bug described to me by @BillyONeal.

Reviewers: BillyONeal, STL_MSFT, CaseyCarter

Reviewed By: BillyONeal

Subscribers: cfe-commits, BillyONeal

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@298554 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22 22:41:41 +00:00