diff options
author | Jason Merrill <jason@redhat.com> | 2014-01-30 22:47:22 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2014-01-30 22:47:22 -0500 |
commit | f221dc810d12ca6005ecee515f786eef31f81960 (patch) | |
tree | abea7991ad3abebb58a9902efc8bf9ff97aa298b /libstdc++-v3 | |
parent | 56e13ae00611a97d28f5284513c45f829a9810c9 (diff) | |
download | gcc-f221dc810d12ca6005ecee515f786eef31f81960.zip gcc-f221dc810d12ca6005ecee515f786eef31f81960.tar.gz gcc-f221dc810d12ca6005ecee515f786eef31f81960.tar.bz2 |
re PR c++/57899 (bind/function with data member: infinite recursion)
PR c++/57899
* cp-tree.h (struct saved_scope): Add x_local_specializations.
(local_specializations): New macro.
* pt.c (local_specializations): Remove variable.
From-SVN: r207332
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/testsuite/20_util/bind/57899.cc | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/20_util/bind/57899.cc b/libstdc++-v3/testsuite/20_util/bind/57899.cc new file mode 100644 index 0000000..d46d53e --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/bind/57899.cc @@ -0,0 +1,48 @@ +// Copyright (C) 2010-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/>. + +// 20.7.11 Function template bind + +// PR c++/57899 +// { dg-do compile } +// { dg-options -std=c++11 } + +#include <functional> +using std::bind; +using std::placeholders::_1; + +struct S { int i; }; + +struct P { S s; }; + +struct get_s +{ + const S& operator()(const P& p) const { return p.s; } +} gs; + +int gi(const S& s) { return s.i; } + +bool cmp(int, int) { return true; } + +int main() +{ + P p{}; + auto f1 = bind(gs, _1); + auto f2 = bind(gi, f1); + auto f3 = bind(cmp, f2, 5); + f3(p); +} |