diff options
| author | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-27 20:25:12 +0000 |
|---|---|---|
| committer | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-27 20:25:12 +0000 |
| commit | 263f25bdc576c5da3dfbe05194f871c3bf3f0494 (patch) | |
| tree | 4c6ae0dab0d8cfdb62ecd5d97976b58d0293e3af /libstdc++-v3/testsuite/20_util/function_objects | |
| parent | fa9db8436afb329872e5fd48dac808d36283b017 (diff) | |
| download | ppe42-gcc-263f25bdc576c5da3dfbe05194f871c3bf3f0494.tar.gz ppe42-gcc-263f25bdc576c5da3dfbe05194f871c3bf3f0494.zip | |
* include/std/functional (mem_fn): Qualify to prevent ADL.
* testsuite/20_util/function_objects/mem_fn/adl.cc: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185895 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite/20_util/function_objects')
| -rw-r--r-- | libstdc++-v3/testsuite/20_util/function_objects/mem_fn/adl.cc | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/20_util/function_objects/mem_fn/adl.cc b/libstdc++-v3/testsuite/20_util/function_objects/mem_fn/adl.cc new file mode 100644 index 00000000000..907db848911 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/function_objects/mem_fn/adl.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2012 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/>. + +#include <functional> + +namespace n { + struct X { int i; }; + void mem_fn(int X::*); +} + +using n::X; + +X x{}; +int X::* p = &X::i; + +int test01() +{ + auto ref = std::ref(p); + return ref(x); +} + +int test02() +{ + std::function<int(X)> fun(p); + return fun(x); +} + |

