38 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// UNSUPPORTED: no-threads10// UNSUPPORTED: c++0311 12// <future>13 14// class packaged_task<R(ArgTypes...)>15// template <class F>16// packaged_task(F&& f);17// These constructors shall not participate in overload resolution if18// decay<F>::type is the same type as std::packaged_task<R(ArgTypes...)>.19 20#include <future>21#include <cassert>22 23struct A {};24typedef std::packaged_task<A(int, char)> PT;25typedef volatile std::packaged_task<A(int, char)> VPT;26 27 28int main(int, char**)29{30 VPT init{};31 auto const& c_init = init;32 PT p1{init}; // expected-error {{no matching constructor}}33 PT p2{c_init}; // expected-error {{no matching constructor}}34 PT p3{std::move(init)}; // expected-error-re {{no matching constructor for initialization of 'PT' (aka {{.+}})}}35 36 return 0;37}38