]>
Commit | Line | Data |
---|---|---|
8868286e | 1 | // { dg-options "-std=gnu++11" } |
bff619dc | 2 | // { dg-do compile } |
3 | ||
f1717362 | 4 | // Copyright (C) 2012-2016 Free Software Foundation, Inc. |
bff619dc | 5 | // |
6 | // This file is part of the GNU ISO C++ Library. This library is free | |
7 | // software; you can redistribute it and/or modify it under the | |
8 | // terms of the GNU General Public License as published by the | |
9 | // Free Software Foundation; either version 3, or (at your option) | |
10 | // any later version. | |
11 | ||
12 | // This library is distributed in the hope that it will be useful, | |
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | // GNU General Public License for more details. | |
16 | ||
17 | // You should have received a copy of the GNU General Public License along | |
18 | // with this library; see the file COPYING3. If not see | |
19 | // <http://www.gnu.org/licenses/>. | |
20 | ||
21 | #include <functional> | |
22 | #include <type_traits> | |
23 | ||
24 | struct X { | |
25 | int i; | |
26 | void f1() { } | |
27 | void f2() volatile { } | |
28 | }; | |
29 | ||
30 | typedef int X::*pm; | |
31 | typedef void (X::*pmf1)(); | |
32 | typedef void (X::*pmf2)() volatile; | |
33 | ||
34 | typedef std::result_of<pm const&(X&)>::type result; | |
35 | static_assert(std::is_same<result, int&>::value, | |
36 | "invoking cv-qualified pointer-to-member-object"); | |
37 | ||
38 | typedef std::result_of<pmf1 const&(X&)>::type result1; | |
39 | static_assert(std::is_void<result1>::value, | |
40 | "invoking cv-qualified pointer-to-member-function"); | |
41 | ||
42 | typedef std::result_of<pmf2 const&(X&)>::type result2; | |
43 | static_assert(std::is_void<result2>::value, | |
44 | "invoking cv-qualified pointer-to-member-function"); | |
45 | ||
46 | typedef std::result_of<pm(volatile X&)>::type result3; | |
47 | static_assert(std::is_same<result3, volatile int&>::value, | |
48 | "invoking pointer-to-member-object on volatile object"); | |
49 | ||
50 | typedef std::result_of<pmf2(volatile X&)>::type result4; | |
51 | static_assert(std::is_void<result4>::value, | |
52 | "invoking pointer-to-member-function on volatile object"); | |
53 |