aboutsummaryrefslogtreecommitdiff
path: root/test/std/utilities/tuple/tuple.tuple/tuple.elem/tuple.by.type.fail.cpp
blob: 74e6efd983bd432498ebd07654ead79bfe2f26ec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//===----------------------------------------------------------------------===//
//
//                     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, c++11

#include <tuple>
#include <string>

struct UserType {};

void test_bad_index() {
    std::tuple<long, long, char, std::string, char, UserType, char> t1;
    (void)std::get<int>(t1); // expected-error@tuple:* {{type not found}}
    (void)std::get<long>(t1); // expected-note {{requested here}}
    (void)std::get<char>(t1); // expected-note {{requested here}}
        // expected-error@tuple:* 2 {{type occurs more than once}}
    std::tuple<> t0;
    (void)std::get<char*>(t0); // expected-node {{requested here}}
        // expected-error@tuple:* 1 {{type not in empty type list}}
}

void test_bad_return_type() {
    typedef std::unique_ptr<int> upint;
    std::tuple<upint> t;
    upint p = std::get<upint>(t); // expected-error{{deleted copy constructor}}
}

int main()
{
    test_bad_index();
    test_bad_return_type();
}