]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/30_threads/stop_token/stop_callback/destructible_neg.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 30_threads / stop_token / stop_callback / destructible_neg.cc
CommitLineData
83ffe9cd 1// Copyright (C) 2020-2023 Free Software Foundation, Inc.
0a8f4feb
JW
2//
3// This file is part of the GNU ISO C++ Library. This library is free
4// software; you can redistribute it and/or modify it under the
5// terms of the GNU General Public License as published by the
6// Free Software Foundation; either version 3, or (at your option)
7// any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13
14// You should have received a copy of the GNU General Public License along
15// with this library; see the file COPYING3. If not see
16// <http://www.gnu.org/licenses/>.
17
18// { dg-options "-std=gnu++2a" }
19// { dg-do compile { target c++2a } }
20
21#include <stop_token>
22
23struct F
24{
25 F();
26
27 void operator()() const { }
28
29private:
30 ~F();
31};
32
33auto
34test01(std::stop_token& tok, F& f)
35{
36 auto ok = sizeof(std::stop_callback<F&>);
37 auto bad = sizeof(std::stop_callback<F>); // { dg-error "here" }
38 return ok + bad;
39}
40
41struct G
42{
43 G();
44 ~G() noexcept(false);
45
46 void operator()() const { }
47};
48
49auto
50test02(std::stop_token& tok, G& g)
51{
52 auto ok = sizeof(std::stop_callback<G&>);
53 auto bad = sizeof(std::stop_callback<G>); // { dg-error "here" }
54 return ok + bad;
55}
56
57// { dg-error "static assertion failed" "" { target *-*-* } 0 }