1 // Copyright (C) 2017 Free Software Foundation, Inc.
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)
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.
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/>.
18 // { dg-options "-std=gnu++17" }
19 // { dg-do compile { target c++17 } }
23 template<typename T
, typename U
> struct require_same
;
24 template<typename T
> struct require_same
<T
, T
> { using type
= void; };
26 template<typename T
, typename U
>
27 typename require_same
<T
, U
>::type
35 long f1ln(double*) noexcept
;
40 std::function func1
= f0v
;
41 check_type
<std::function
<void()>>(func1
);
43 std::function func2
= f0vn
;
44 check_type
<std::function
<void()>>(func2
);
46 std::function func3
= f0i
;
47 check_type
<std::function
<int()>>(func3
);
49 std::function func4
= f0in
;
50 check_type
<std::function
<int()>>(func4
);
52 std::function func5
= f1l
;
53 check_type
<std::function
<long(int&)>>(func5
);
55 std::function func6
= f1ln
;
56 check_type
<std::function
<long(double*)>>(func6
);
58 std::function func5a
= func5
;
59 check_type
<std::function
<long(int&)>>(func5a
);
61 std::function func6a
= func6
;
62 check_type
<std::function
<long(double*)>>(func6a
);
66 int operator()(const short&, void*);
70 void operator()(int) const & noexcept
;
77 std::function func1
= x
;
78 check_type
<std::function
<int(const short&, void*)>>(func1
);
81 std::function func2
= y
;
82 check_type
<std::function
<void(int)>>(func2
);
84 std::function func3
= [&x
](float) -> X
& { return x
; };
85 check_type
<std::function
<X
&(float)>>(func3
);