The following test.cpp: #include <tr1/functional> struct A { void foo() {} }; int main() { std::tr1::mem_fn(&A::foo); } compiled with: g++ -Wshadow test.cpp causes: /usr/include/c++/4.0.0/tr1/functional_iterate.h: In constructor 'std::tr1::_Mem_fn<_Res (_Class::*)()>::_Mem_fn(_Res (_Class::*)()) [with _Res = void, _Class = A]': /usr/include/c++/4.0.0/tr1/functional:502: instantiated from 'std::tr1::_Mem_fn<_Res _Class::*> std::tr1::mem_fn(_Tp _Class::*) [with _Tp = void ()(), _Class = A]' test.cpp:10: instantiated from here /usr/include/c++/4.0.0/tr1/functional_iterate.h:202: warning: declaration of '__pmf' shadows a member of 'this' The following patch will silence the warning: $ svn diff Index: libstdc++-v3/include/tr1/functional_iterate.h =================================================================== --- libstdc++-v3/include/tr1/functional_iterate.h (revision 117204) +++ libstdc++-v3/include/tr1/functional_iterate.h (working copy) @@ -195,7 +195,7 @@ public: typedef _Res result_type; - explicit _Mem_fn(_Functor __pmf) : __pmf(__pmf) { } + explicit _Mem_fn(_Functor __pf) : __pmf(__pf) { } // Handle objects _Res @@ -249,7 +249,7 @@ public: typedef _Res result_type; - explicit _Mem_fn(_Functor __pmf) : __pmf(__pmf) { } + explicit _Mem_fn(_Functor __pf) : __pmf(__pf) { } // Handle objects _Res @@ -303,7 +303,7 @@ public: typedef _Res result_type; - explicit _Mem_fn(_Functor __pmf) : __pmf(__pmf) { } + explicit _Mem_fn(_Functor __pf) : __pmf(__pf) { } // Handle objects _Res @@ -357,7 +357,7 @@ public: typedef _Res result_type; - explicit _Mem_fn(_Functor __pmf) : __pmf(__pmf) { } + explicit _Mem_fn(_Functor __pf) : __pmf(__pf) { } // Handle objects _Res
Thanks Howard.
Subject: Bug 29224 Author: paolo Date: Tue Sep 26 00:59:37 2006 New Revision: 117222 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117222 Log: 2006-09-26 Howard Hinnant <hhinnant@apple.com> PR libstdc++/29224 * include/tr1/functional_iterate.h: Avoid -Wshadow warnings. Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/tr1/functional_iterate.h
Subject: Bug 29224 Author: paolo Date: Tue Sep 26 00:59:53 2006 New Revision: 117223 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117223 Log: 2006-09-26 Howard Hinnant <hhinnant@apple.com> PR libstdc++/29224 * include/tr1/functional_iterate.h: Avoid -Wshadow warnings. Modified: branches/gcc-4_1-branch/libstdc++-v3/ChangeLog branches/gcc-4_1-branch/libstdc++-v3/include/tr1/functional_iterate.h
Fixed for 4.1.2.
*** Bug 29603 has been marked as a duplicate of this bug. ***