This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/6125: template parameter of type ptr-to-member does not match



>Number:         6125
>Category:       c++
>Synopsis:       template parameter of type ptr-to-member does not match
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 01 13:36:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     tot@trema.com
>Release:        gcc 3.1 20020401 (fails also with a week earlier version)
>Organization:
>Environment:
Mandrake 8.2 i586	
>Description:
The following code bug.cc does not compile.  
The compiler does not find a matching method in copy-ctor.

It works and compiles fine if the parameter to 'tester' is passed as reference and not by value.

This is regression from 3.0.
>How-To-Repeat:
Try compiling bug.cc without any options.  The compiler will say
/opt/gcc3.1/lib/gcc-lib/i686-pc-linux-gnu/3.1/include/g++/bits/stl_list.h: In
   member function `void std::list<_Tp,
   _Alloc>::_M_insert_dispatch(std::_List_iterator<_Tp, _Tp&, _Tp*>,
   _InputIter, _InputIter, __false_type) [with _InputIterator =
   std::_List_iterator<bool (A::*)(std::ostream&) const, bool
   (A::*const&)(std::ostream&) const, bool (A::*const*)(std::ostream&) const>,
   _Tp = bool (A::*)(std::ostream&) const, _Alloc = std::allocator<bool
   (A::*)(std::ostream&) const>]':
/opt/gcc3.1/lib/gcc-lib/i686-pc-linux-gnu/3.1/include/g++/bits/stl_list.h:459:
 instantiated from `void std::list<_Tp, _Alloc>::insert(std::_List_iterator<_Tp, _Tp&, _Tp*>, _InputIterator, _InputIterator) [with _InputIterator = std::_List_iterator<bool (A::*)(std::ostream&) const, bool (A::*const&)(std::ostream&) const, bool (A::*const*)(std::ostream&) const>, _Tp = bool (A::*)(std::ostream&) const, _Alloc = std::allocator<bool (A::*)(std::ostream&) const>]'
/opt/gcc3.1/lib/gcc-lib/i686-pc-linux-gnu/3.1/include/g++/bits/stl_list.h:543:
 instantiated from `std::list<_Tp, _Alloc>::list(const std::list<_Tp, _Alloc>&)
[with _Tp = bool (A::*)(std::ostream&) const, _Alloc = std::allocator<bool (A::*)(std::ostream&) const>]'
bug.cc:53:   instantiated from here
/opt/gcc3.1/lib/gcc-lib/i686-pc-linux-gnu/3.1/include/g++/bits/stl_list.h:730: no
   matching function for call to `std::list<bool (A::*)(std::ostream&) const,
   std::allocator<bool (A::*)(std::ostream&) const> >::insert(
   std::_List_iterator<bool (A::*)(std::ostream&) const, bool
   (A::*&)(std::ostream&) const, bool (A::**)(std::ostream&) const>&, bool
   (A::*const&)(std::ostream&) const)'
/opt/gcc3.1/lib/gcc-lib/i686-pc-linux-gnu/3.1/include/g++/bits/stl_list.h:429: candidates
   are: std::_List_iterator<_Tp, _Tp&, _Tp*> std::list<_Tp,
   _Alloc>::insert(std::_List_iterator<_Tp, _Tp&, _Tp*>, const _Tp&) [with _Tp
   = bool (A::*)(std::ostream&) const, _Alloc = std::allocator<bool
   (A::*)(std::ostream&) const>]
/opt/gcc3.1/lib/gcc-lib/i686-pc-linux-gnu/3.1/include/g++/bits/stl_list.h:440:
                  std::_List_iterator<_Tp, _Tp&, _Tp*> std::list<_Tp,
   _Alloc>::insert(std::_List_iterator<_Tp, _Tp&, _Tp*>) [with _Tp = bool
   (A::*)(std::ostream&) const, _Alloc = std::allocator<bool
   (A::*)(std::ostream&) const>]
/opt/gcc3.1/lib/gcc-lib/i686-pc-linux-gnu/3.1/include/g++/bits/stl_list.h:464:
                  void std::list<_Tp, _Alloc>::insert(std::_List_iterator<_Tp,
   _Tp&, _Tp*>, unsigned int, const _Tp&) [with _Tp = bool
   (A::*)(std::ostream&) const, _Alloc = std::allocator<bool
   (A::*)(std::ostream&) const>]

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/x-c++src; name="bug.cc"
Content-Transfer-Encoding: base64
Content-Disposition: att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