diff options
author | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-11-03 02:55:32 +0000 |
---|---|---|
committer | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-11-03 02:55:32 +0000 |
commit | aa257c03733087140f251c90c8072e2cf1d1f779 (patch) | |
tree | ae70857bf8288024edfc24fa8e93d3b1962efda8 /libstdc++-v3/testsuite | |
parent | c29261e5914037de2881418bee302cc40c31c98b (diff) | |
download | gcc-aa257c03733087140f251c90c8072e2cf1d1f779.tar.gz |
Add support for ref-qualified functions to std::mem_fn
PR libstdc++/57898
* include/std/functional (_Mem_fn_traits_base): New class template.
(_Mem_fn_traits): New class template with specializations for every
combination of cv-qualified and ref-qualified member function.
(_Mem_fn_base): New class template for all pointer to member function
types and partial specialization for pointer to member object types.
(_Mem_fn): Inherit from _Mem_fn_base.
* testsuite/20_util/function_objects/mem_fn/refqual.cc: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217024 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite')
-rw-r--r-- | libstdc++-v3/testsuite/20_util/function_objects/mem_fn/refqual.cc | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/20_util/function_objects/mem_fn/refqual.cc b/libstdc++-v3/testsuite/20_util/function_objects/mem_fn/refqual.cc new file mode 100644 index 00000000000..35a66e55410 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/function_objects/mem_fn/refqual.cc @@ -0,0 +1,34 @@ +// Copyright (C) 2014 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +#include <functional> + +struct Foo +{ + void r()&& { } + int l() const& { return 0; } +}; + +void test01() +{ + Foo f; + int i = std::mem_fn(&Foo::l)( f ); + std::mem_fn(&Foo::r)( std::move(f) ); +} |