diff options
author | Eric Fiselier <eric@efcs.ca> | 2016-07-25 01:45:07 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2016-07-25 01:45:07 +0000 |
commit | 189f88ca35cd038da52bfdb338e37a0c15fa69bb (patch) | |
tree | db048945da4dc4f8aaf59c573866aaa44f505506 /libcxx/test/std/utilities/utility/pairs/pairs.pair/assign_pair.pass.cpp | |
parent | d6ddc7e0a8a34600eefdbce0ac36da5ef22f1642 (diff) | |
download | bcm5719-llvm-189f88ca35cd038da52bfdb338e37a0c15fa69bb.tar.gz bcm5719-llvm-189f88ca35cd038da52bfdb338e37a0c15fa69bb.zip |
Revert r276548 - Make pair/tuples assignment operators SFINAE properly.
This is a breaking change. The SFINAE required is instantiated the second
the class is instantiated, and this can cause hard SFINAE errors
when applied to references to incomplete types. Ex.
struct IncompleteType;
extern IncompleteType it;
std::tuple<IncompleteType&> t(it); // SFINAE will blow up.
llvm-svn: 276598
Diffstat (limited to 'libcxx/test/std/utilities/utility/pairs/pairs.pair/assign_pair.pass.cpp')
-rw-r--r-- | libcxx/test/std/utilities/utility/pairs/pairs.pair/assign_pair.pass.cpp | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/libcxx/test/std/utilities/utility/pairs/pairs.pair/assign_pair.pass.cpp b/libcxx/test/std/utilities/utility/pairs/pairs.pair/assign_pair.pass.cpp deleted file mode 100644 index d75b6a5f820..00000000000 --- a/libcxx/test/std/utilities/utility/pairs/pairs.pair/assign_pair.pass.cpp +++ /dev/null @@ -1,90 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03 - -// <utility> - -// template <class T1, class T2> struct pair - -// pair& operator=(pair const& p); - -#include <utility> -#include <memory> -#include <cassert> - - -struct NonAssignable { - NonAssignable& operator=(NonAssignable const&) = delete; - NonAssignable& operator=(NonAssignable&&) = delete; -}; -struct CopyAssignable { - CopyAssignable() = default; - CopyAssignable(CopyAssignable const&) = default; - CopyAssignable& operator=(CopyAssignable const&) = default; - CopyAssignable& operator=(CopyAssignable&&) = delete; -}; -struct MoveAssignable { - MoveAssignable() = default; - MoveAssignable& operator=(MoveAssignable const&) = delete; - MoveAssignable& operator=(MoveAssignable&&) = default; -}; - - -struct CountAssign { - static int copied; - static int moved; - static void reset() { copied = moved = 0; } - CountAssign() = default; - CountAssign& operator=(CountAssign const&) { ++copied; return *this; } - CountAssign& operator=(CountAssign&&) { ++moved; return *this; } -}; -int CountAssign::copied = 0; -int CountAssign::moved = 0; - -int main() -{ - { - typedef std::pair<CopyAssignable, short> P; - const P p1(CopyAssignable(), 4); - P p2; - p2 = p1; - assert(p2.second == 4); - } - { - using P = std::pair<int&, int&&>; - int x = 42; - int y = 101; - int x2 = -1; - int y2 = 300; - P p1(x, std::move(y)); - P p2(x2, std::move(y2)); - p1 = p2; - assert(p1.first == x2); - assert(p1.second == y2); - } - { - using P = std::pair<int, NonAssignable>; - static_assert(!std::is_copy_assignable<P>::value, ""); - } - { - CountAssign::reset(); - using P = std::pair<CountAssign, CopyAssignable>; - static_assert(std::is_copy_assignable<P>::value, ""); - P p; - P p2; - p = p2; - assert(CountAssign::copied == 1); - assert(CountAssign::moved == 0); - } - { - using P = std::pair<int, MoveAssignable>; - static_assert(!std::is_copy_assignable<P>::value, ""); - } -} |