Revert r372777: [libc++] Implement LWG 2510 and its follow-ups

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@372832 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Ilya Biryukov
2019-09-25 09:10:38 +00:00
parent 1ee6c64cc8
commit 29a4eab8c5
52 changed files with 105 additions and 475 deletions

View File

@@ -13,6 +13,9 @@
// Test that reference wrapper meets the requirements of CopyConstructible and
// CopyAssignable, and TriviallyCopyable (starting in C++14).
// Test fails due to use of is_trivially_* trait.
// XFAIL: gcc-4.9 && c++14
#include <functional>
#include <type_traits>
#include <string>

View File

@@ -1,29 +0,0 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// Before GCC 6, aggregate initialization kicks in.
// See https://stackoverflow.com/q/41799015/627587.
// UNSUPPORTED: gcc-5
// <memory>
// struct allocator_arg_t { explicit allocator_arg_t() = default; };
// const allocator_arg_t allocator_arg = allocator_arg_t();
// This test checks for LWG 2510.
#include <memory>
std::allocator_arg_t f() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}}
int main(int, char**) {
return 0;
}

View File

@@ -8,7 +8,7 @@
// <memory>
// struct allocator_arg_t { explicit allocator_arg_t() = default; };
// struct allocator_arg_t { };
// const allocator_arg_t allocator_arg = allocator_arg_t();
#include <memory>
@@ -21,5 +21,5 @@ int main(int, char**)
{
test(std::allocator_arg);
return 0;
return 0;
}

View File

@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14
// XFAIL: gcc-5, gcc-6
// XFAIL: gcc-4, gcc-5, gcc-6
// <memory>

View File

@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14
// UNSUPPORTED: clang-3, clang-4, clang-5, apple-clang, gcc-5, gcc-6
// UNSUPPORTED: clang-3, clang-4, clang-5, apple-clang, gcc-4, gcc-5, gcc-6
// type_traits

View File

@@ -10,6 +10,8 @@
// is_trivially_assignable
// XFAIL: gcc-4.9
#include <type_traits>
#include "test_macros.h"

View File

@@ -10,6 +10,8 @@
// is_trivially_copy_assignable
// XFAIL: gcc-4.9
#include <type_traits>
#include "test_macros.h"

View File

@@ -10,6 +10,8 @@
// is_trivially_copy_constructible
// XFAIL: gcc-4.9
#include <type_traits>
#include "test_macros.h"

View File

@@ -10,6 +10,8 @@
// is_trivially_move_assignable
// XFAIL: gcc-4.9
#include <type_traits>
#include "test_macros.h"

View File

@@ -10,6 +10,8 @@
// is_trivially_move_constructible
// XFAIL: gcc-4.9
#include <type_traits>
#include "test_macros.h"

View File

@@ -1,33 +0,0 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <tuple>
// template <class... Types> class tuple;
// template <class Alloc>
// explicit(see-below) tuple(allocator_arg_t, const Alloc& a);
// Make sure we get the explicit-ness of the constructor right.
// This is LWG 3158.
#include <tuple>
#include <memory>
struct ExplicitDefault { explicit ExplicitDefault() { } };
std::tuple<ExplicitDefault> explicit_default_test() {
return {std::allocator_arg, std::allocator<int>()}; // expected-error {{chosen constructor is explicit in copy-initialization}}
}
int main(int, char**) {
return 0;
}

View File

@@ -13,7 +13,7 @@
// template <class... Types> class tuple;
// template <class Alloc>
// explicit(see-below) tuple(allocator_arg_t, const Alloc& a);
// tuple(allocator_arg_t, const Alloc& a);
// NOTE: this constructor does not currently support tags derived from
// allocator_arg_t because libc++ has to deduce the parameter as a template

View File

@@ -1,53 +0,0 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// Before GCC 6, aggregate initialization kicks in.
// See https://stackoverflow.com/q/41799015/627587.
// UNSUPPORTED: gcc-5
// <tuple>
// template <class... Types> class tuple;
// explicit(see-below) constexpr tuple();
#include <tuple>
struct Implicit {
Implicit() = default;
};
struct Explicit {
explicit Explicit() = default;
};
std::tuple<> test1() { return {}; }
std::tuple<Implicit> test2() { return {}; }
std::tuple<Explicit> test3() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}}
std::tuple<Implicit, Implicit> test4() { return {}; }
std::tuple<Explicit, Implicit> test5() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}}
std::tuple<Implicit, Explicit> test6() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}}
std::tuple<Explicit, Explicit> test7() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}}
std::tuple<Implicit, Implicit, Implicit> test8() { return {}; }
std::tuple<Implicit, Implicit, Explicit> test9() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}}
std::tuple<Implicit, Explicit, Implicit> test10() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}}
std::tuple<Implicit, Explicit, Explicit> test11() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}}
std::tuple<Explicit, Implicit, Implicit> test12() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}}
std::tuple<Explicit, Implicit, Explicit> test13() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}}
std::tuple<Explicit, Explicit, Implicit> test14() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}}
std::tuple<Explicit, Explicit, Explicit> test15() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}}
int main(int, char**) {
return 0;
}

View File

@@ -10,7 +10,7 @@
// template <class... Types> class tuple;
// explicit(see-below) constexpr tuple();
// constexpr tuple();
// UNSUPPORTED: c++98, c++03

View File

@@ -14,6 +14,7 @@
// struct tuple_size<tuple<Types...>>
// : public integral_constant<size_t, sizeof...(Types)> { };
// XFAIL: gcc-4.9
// UNSUPPORTED: c++98, c++03
#include <tuple>

View File

@@ -14,6 +14,7 @@
// class tuple_size<tuple<Types...>>
// : public integral_constant<size_t, sizeof...(Types)> { };
// XFAIL: gcc-4.9
// UNSUPPORTED: c++98, c++03
#include <tuple>

View File

@@ -12,7 +12,7 @@
// template <class T1, class T2> struct pair
// struct piecewise_construct_t { explicit piecewise_construct_t() = default; };
// struct piecewise_construct_t { };
// constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
#include <utility>

View File

@@ -1,29 +0,0 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// Before GCC 6, aggregate initialization kicks in.
// See https://stackoverflow.com/q/41799015/627587.
// UNSUPPORTED: gcc-5
// <utility>
// struct piecewise_construct_t { explicit piecewise_construct_t() = default; };
// constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
// This test checks for LWG 2510.
#include <utility>
std::piecewise_construct_t f() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}}
int main(int, char**) {
return 0;
}

View File

@@ -1,24 +0,0 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <utility>
// struct piecewise_construct_t { explicit piecewise_construct_t() = default; };
// constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
#include <utility>
int main(int, char**) {
std::piecewise_construct_t x = std::piecewise_construct;
(void)x;
return 0;
}

View File

@@ -1,42 +0,0 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// Before GCC 6, aggregate initialization kicks in.
// See https://stackoverflow.com/q/41799015/627587.
// UNSUPPORTED: gcc-5
// <utility>
// template <class T1, class T2> struct pair
// explicit(see-below) constexpr pair();
// This test checks the conditional explicitness of std::pair's default
// constructor as introduced by the resolution of LWG 2510.
#include <utility>
struct ImplicitlyDefaultConstructible {
ImplicitlyDefaultConstructible() = default;
};
struct ExplicitlyDefaultConstructible {
explicit ExplicitlyDefaultConstructible() = default;
};
std::pair<ImplicitlyDefaultConstructible, ExplicitlyDefaultConstructible> test1() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}}
std::pair<ExplicitlyDefaultConstructible, ImplicitlyDefaultConstructible> test2() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}}
std::pair<ExplicitlyDefaultConstructible, ExplicitlyDefaultConstructible> test3() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}}
std::pair<ImplicitlyDefaultConstructible, ImplicitlyDefaultConstructible> test4() { return {}; }
int main(int, char**) {
return 0;
}

View File

@@ -10,7 +10,12 @@
// template <class T1, class T2> struct pair
// explicit(see-below) constexpr pair();
// constexpr pair();
// This test doesn't pass due to a constexpr bug in GCC 4.9 that fails
// to initialize any type without a user provided constructor in a constant
// expression (e.g. float).
// XFAIL: gcc-4.9
// NOTE: The SFINAE on the default constructor is tested in
// default-sfinae.pass.cpp

View File

@@ -13,6 +13,9 @@
// pair(pair const&) = default;
// pair(pair&&) = default;
// Doesn't pass due to use of is_trivially_* trait.
// XFAIL: gcc-4.9
#include <utility>
#include <cassert>