1 | //===----------------------------------------------------------------------===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | // Regression test for https://llvm.org/PR38601 |
10 | |
11 | // UNSUPPORTED: c++03 |
12 | |
13 | #include <cassert> |
14 | #include <tuple> |
15 | |
16 | using Base = std::tuple<int, int>; |
17 | |
18 | struct Derived : Base { |
19 | template <class ...Ts> |
20 | Derived(int x, Ts... ts): Base(ts...), x_(x) { } |
21 | operator int () const { return x_; } |
22 | int x_; |
23 | }; |
24 | |
25 | int main(int, char**) { |
26 | Derived d(1, 2, 3); |
27 | Base b = static_cast<Base>(d); |
28 | assert(std::get<0>(b) == 2); |
29 | assert(std::get<1>(b) == 3); |
30 | return 0; |
31 | } |
32 | |