32 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// Regression test for https://llvm.org/PR3860110 11// UNSUPPORTED: c++0312 13#include <cassert>14#include <tuple>15 16using Base = std::tuple<int, int>;17 18struct 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 25int 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