1 // { dg-options "-std=gnu++0x" }
4 // Copyright (C) 2012-2013 Free Software Foundation, Inc.
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)
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.
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/>.
22 #include <type_traits>
27 void f2() volatile { }
31 typedef void (X::*pmf1
)();
32 typedef void (X::*pmf2
)() volatile;
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");
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");
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");
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");
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");