Add test case for PR31384
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@289774 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -0,0 +1,38 @@
|
|||||||
|
// -*- 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.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
// UNSUPPORTED: c++98, c++03
|
||||||
|
|
||||||
|
// <tuple>
|
||||||
|
|
||||||
|
// template <class TupleLike> tuple(TupleLike&&); // libc++ extension
|
||||||
|
|
||||||
|
// See llvm.org/PR31384
|
||||||
|
|
||||||
|
#include <tuple>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct derived : std::tuple<T> {
|
||||||
|
using std::tuple<T>::tuple;
|
||||||
|
template<class U>
|
||||||
|
operator std::tuple<U>() && {
|
||||||
|
++count;
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
std::tuple<int> foo = derived<int&&>{42};
|
||||||
|
assert(count == 1);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user