]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/blob
589539317b6736f7f155c80a45274999649588d2
[thirdparty/openembedded/openembedded-core-contrib.git] /
1 From f6e12aec843ba3a839f49b60a5ca092f2fadd876 Mon Sep 17 00:00:00 2001
2 From: redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
3 Date: Sun, 10 Apr 2011 16:29:05 +0000
4 Subject: [PATCH 098/200] 2011-04-10 Jonathan Wakely <jwakely.gcc@gmail.com>
5
6 PR libstdc++/48541
7 * include/std/functional (_Base_manager::_M_get_pointer): Use
8 addressof.
9 * testsuite/20_util/function/48541.cc: New.
10
11
12
13 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@172242 138bc75d-0d04-0410-961f-82ee72b054a4
14
15 index 6643b76..660e371 100644
16 --- a/libstdc++-v3/include/std/functional
17 +++ b/libstdc++-v3/include/std/functional
18 @@ -1586,7 +1586,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
19 _M_get_pointer(const _Any_data& __source)
20 {
21 const _Functor* __ptr =
22 - __stored_locally? &__source._M_access<_Functor>()
23 + __stored_locally? std::__addressof(__source._M_access<_Functor>())
24 /* have stored a pointer */ : __source._M_access<_Functor*>();
25 return const_cast<_Functor*>(__ptr);
26 }
27 diff --git a/libstdc++-v3/testsuite/20_util/function/48451.cc b/libstdc++-v3/testsuite/20_util/function/48451.cc
28 new file mode 100644
29 index 0000000..f812367
30 --- /dev/null
31 +++ b/libstdc++-v3/testsuite/20_util/function/48451.cc
32 @@ -0,0 +1,40 @@
33 +// { dg-options "-std=gnu++0x" }
34 +// { dg-do compile }
35 +// Copyright (C) 2011 Free Software Foundation, Inc.
36 +//
37 +// This file is part of the GNU ISO C++ Library. This library is free
38 +// software; you can redistribute it and/or modify it under the
39 +// terms of the GNU General Public License as published by the
40 +// Free Software Foundation; either version 3, or (at your option)
41 +// any later version.
42 +//
43 +// This library is distributed in the hope that it will be useful,
44 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
45 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
46 +// GNU General Public License for more details.
47 +//
48 +// You should have received a copy of the GNU General Public License along
49 +// with this library; see the file COPYING3. If not see
50 +// <http://www.gnu.org/licenses/>.
51 +
52 +// libstdc++/48451
53 +
54 +#include <functional>
55 +
56 +struct X {
57 + void operator () () const { }
58 + float operator & () const { return 1.2345; }
59 +};
60 +
61 +void test01()
62 +{
63 + X x;
64 + std::function<void()> f(x);
65 + f();
66 +}
67 +
68 +int main()
69 +{
70 + test01();
71 + return 0;
72 +}
73 --
74 1.7.0.4
75