1//===----------------------------------------------------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is dual licensed under the MIT and the University of Illinois Open 6// Source Licenses. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10// <tuple> 11 12// template <class... Types> class tuple; 13 14// template <class... UTypes> 15// explicit tuple(UTypes&&... u); 16 17// UNSUPPORTED: c++98, c++03 18 19/* 20 This is testing an extension whereby only Types having an explicit conversion 21 from UTypes are bound by the explicit tuple constructor. 22*/ 23 24#include <tuple> 25#include <cassert> 26 27class MoveOnly 28{ 29 MoveOnly(const MoveOnly&); 30 MoveOnly& operator=(const MoveOnly&); 31 32 int data_; 33public: 34 explicit MoveOnly(int data = 1) : data_(data) {} 35 MoveOnly(MoveOnly&& x) 36 : data_(x.data_) {x.data_ = 0;} 37 MoveOnly& operator=(MoveOnly&& x) 38 {data_ = x.data_; x.data_ = 0; return *this;} 39 40 int get() const {return data_;} 41 42 bool operator==(const MoveOnly& x) const {return data_ == x.data_;} 43 bool operator< (const MoveOnly& x) const {return data_ < x.data_;} 44}; 45 46int main() 47{ 48 { 49 std::tuple<MoveOnly> t = 1; 50 } 51} 52