]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/20_util/bind/68912.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 20_util / bind / 68912.cc
CommitLineData
99dee823 1// Copyright (C) 2015-2021 Free Software Foundation, Inc.
66667312
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
52066eae 18// { dg-do compile { target c++11 } }
66667312
JW
19
20#include<functional>
21
22struct Wrong {};
23struct A {};
24struct B {};
25struct C{};
26struct D{};
27
28struct X {
29 A operator()(int, double) & { return {}; }
30 Wrong operator()(int, double) && {return {}; }
31
32 B operator()(int, double) const & { return {}; }
33 Wrong operator()(int, double) const && {return {}; }
34
35 C operator()(int, double) volatile & { return {}; }
36 Wrong operator()(int, double) volatile && {return {}; }
37
38 D operator()(int, double) const volatile & { return {}; }
39 Wrong operator()(int, double) const volatile && {return {}; }
40};
41
42void test01()
43{
44 auto bound = std::bind(X{}, 5, std::placeholders::_1);
45 A res = bound(1.0);
46 const auto bound_c = bound;
47 B res_c = bound_c(1.0);
de1d0794 48#if __cplusplus <= 201402L
66667312
JW
49 volatile auto bound_v = bound;
50 C res_v = bound_v(1.0);
51 volatile const auto bound_cv = bound;
52 D res_cv = bound_cv(1.0);
de1d0794 53#endif
66667312 54}