1// { dg-options "-std=gnu++11" } 2// { dg-do compile } 3 4// Copyright (C) 2012-2015 Free Software Foundation, Inc. 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 24struct X { 25 int i; 26 void f1() { } 27 void f2() volatile { } 28}; 29 30typedef int X::*pm; 31typedef void (X::*pmf1)(); 32typedef void (X::*pmf2)() volatile; 33 34typedef std::result_of<pm const&(X&)>::type result; 35static_assert(std::is_same<result, int&>::value, 36 "invoking cv-qualified pointer-to-member-object"); 37 38typedef std::result_of<pmf1 const&(X&)>::type result1; 39static_assert(std::is_void<result1>::value, 40 "invoking cv-qualified pointer-to-member-function"); 41 42typedef std::result_of<pmf2 const&(X&)>::type result2; 43static_assert(std::is_void<result2>::value, 44 "invoking cv-qualified pointer-to-member-function"); 45 46typedef std::result_of<pm(volatile X&)>::type result3; 47static_assert(std::is_same<result3, volatile int&>::value, 48 "invoking pointer-to-member-object on volatile object"); 49 50typedef std::result_of<pmf2(volatile X&)>::type result4; 51static_assert(std::is_void<result4>::value, 52 "invoking pointer-to-member-function on volatile object"); 53 54