public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/29224]  New: -Wshadow causing warning in <tr1/functional>
@ 2006-09-25 21:51 hhinnant at apple dot com
  2006-09-25 21:55 ` [Bug libstdc++/29224] " pcarlini at suse dot de
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: hhinnant at apple dot com @ 2006-09-25 21:51 UTC (permalink / raw)
  To: gcc-bugs

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


-- 
           Summary: -Wshadow causing warning in <tr1/functional>
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hhinnant at apple dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29224


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-10-26  9:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-25 21:51 [Bug libstdc++/29224] New: -Wshadow causing warning in <tr1/functional> hhinnant at apple dot com
2006-09-25 21:55 ` [Bug libstdc++/29224] " pcarlini at suse dot de
2006-09-26  0:59 ` paolo at gcc dot gnu dot org
2006-09-26  1:00 ` paolo at gcc dot gnu dot org
2006-09-26  1:01 ` pcarlini at suse dot de
2006-10-26  9:30 ` bernie at develer dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).