1 // { dg-do run { target c++11 } }
2 // Copyright (C) 2010-2018 Free Software Foundation, Inc.
4 // This file is part of the GNU ISO C++ Library. This library is free
5 // software; you can redistribute it and/or modify it under the
6 // terms of the GNU General Public License as published by the
7 // Free Software Foundation; either version 3, or (at your option)
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License along
16 // with this library; see the file COPYING3. If not see
17 // <http://www.gnu.org/licenses/>.
19 // 20.8.15 polymorphic function object wrapper
22 #include <testsuite_hooks.h>
27 short operator() ( int && ) { return 1; }
28 short operator() ( int && ) const { return 2; }
29 short operator() ( int && ) volatile { return 3; }
30 short operator() ( int && ) const volatile { return 4; }
31 short func( int && ) { return 5; }
32 short func_c( int && ) const { return 6; }
33 short func_v( int && ) volatile { return 7; }
34 short func_cv( int && ) const volatile { return 8; }
45 Foo
const volatile foo_cv
;
47 std::function
< int ( int && ) > f1( ref(foo
) );
50 std::function
< int ( int && ) > f2( ref(foo_c
) );
53 std::function
< int ( int && ) > f3( ref(foo_v
) );
56 std::function
< int ( int && ) > f4( ref(foo_cv
) );
59 std::function
< int ( Foo
&, int && ) > f5( &Foo::func
) ;
60 VERIFY( f5(foo
, 0) == 5 );
62 std::function
< int ( Foo
const &, int && ) > f6( &Foo::func_c
) ;
63 VERIFY( f6(foo_c
, 0) == 6 );
65 std::function
< int ( Foo
volatile &, int && ) > f7( &Foo::func_v
) ;
66 VERIFY( f7(foo_v
, 0) == 7 );
68 std::function
< int ( Foo
const volatile &, int && ) > f8( &Foo::func_cv
) ;
69 VERIFY( f8(foo_cv
, 0) == 8 );