-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename and rework
_LIBCPP_TRIVIAL_PAIR_COPY_CTOR
. Move FreeBSD conf…
…iguration in-tree. This patch does the following: * It renames `_LIBCPP_TRIVIAL_PAIR_COPY_CTOR` to `_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR`. * It automatically enables this option on FreeBSD in ABI V1, since that's the current ABI FreeBSD ships. * It cleans up the handling of this option in `std::pair`. I would like the sign off from the FreeBSD maintainers. They will no longer need to keep their `__config` changes downstream. I'm still hoping to come up with a better way to maintain the ABI without needing these constructors. Reviewed in https://reviews.llvm.org/D21329 llvm-svn: 275749
- Loading branch information
Showing
3 changed files
with
82 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// The LLVM Compiler Infrastructure | ||
// | ||
// This file is dual licensed under the MIT and the University of Illinois Open | ||
// Source Licenses. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// <utility> | ||
|
||
// template <class T1, class T2> struct pair | ||
|
||
// Doesn't pass due to use of is_trivially_* trait. | ||
// XFAIL: gcc-4.9 | ||
|
||
// Test that we properly provide the old non-trivial copy operations | ||
// when the ABI macro is defined. | ||
|
||
#define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR | ||
#include <utility> | ||
#include <cassert> | ||
|
||
#include "test_macros.h" | ||
|
||
#if TEST_STD_VER >= 11 | ||
struct Dummy { | ||
Dummy(Dummy const&) = delete; | ||
Dummy(Dummy &&) = default; | ||
}; | ||
#endif | ||
|
||
int main() | ||
{ | ||
typedef std::pair<int, short> P; | ||
{ | ||
static_assert(std::is_copy_constructible<P>::value, ""); | ||
static_assert(!std::is_trivially_copy_constructible<P>::value, ""); | ||
} | ||
#if TEST_STD_VER >= 11 | ||
{ | ||
static_assert(std::is_move_constructible<P>::value, ""); | ||
static_assert(!std::is_trivially_move_constructible<P>::value, ""); | ||
} | ||
{ | ||
using P1 = std::pair<Dummy, int>; | ||
// This line fails because the non-trivial constructors do not provide | ||
// SFINAE. | ||
// static_assert(!std::is_copy_constructible<P1>::value, ""); | ||
static_assert(!std::is_trivially_copy_constructible<P1>::value, ""); | ||
static_assert(std::is_move_constructible<P1>::value, ""); | ||
static_assert(!std::is_trivially_move_constructible<P1>::value, ""); | ||
} | ||
#endif | ||
} |