4684ddb6aa
- import libcxx - reduce targets to the one when compiled as a tools Change-Id: Iabb8427f80ff8e89463559a28bcb8b4f2bdbc496
49 lines
1.2 KiB
C++
49 lines
1.2 KiB
C++
//===----------------------------------------------------------------------===//
|
|
//
|
|
// 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.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// <tuple>
|
|
|
|
// template <class... Types> class tuple;
|
|
|
|
// template <class... UTypes>
|
|
// explicit tuple(UTypes&&... u);
|
|
|
|
/*
|
|
This is testing an extension whereby only Types having an explicit conversion
|
|
from UTypes are bound by the explicit tuple constructor.
|
|
*/
|
|
|
|
#include <tuple>
|
|
#include <cassert>
|
|
|
|
class MoveOnly
|
|
{
|
|
MoveOnly(const MoveOnly&);
|
|
MoveOnly& operator=(const MoveOnly&);
|
|
|
|
int data_;
|
|
public:
|
|
explicit MoveOnly(int data = 1) : data_(data) {}
|
|
MoveOnly(MoveOnly&& x)
|
|
: data_(x.data_) {x.data_ = 0;}
|
|
MoveOnly& operator=(MoveOnly&& x)
|
|
{data_ = x.data_; x.data_ = 0; return *this;}
|
|
|
|
int get() const {return data_;}
|
|
|
|
bool operator==(const MoveOnly& x) const {return data_ == x.data_;}
|
|
bool operator< (const MoveOnly& x) const {return data_ < x.data_;}
|
|
};
|
|
|
|
int main()
|
|
{
|
|
{
|
|
std::tuple<MoveOnly> t = 1;
|
|
}
|
|
}
|