public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* libstdc++/3113: DR 109: missing binders for non-const sequence elements
@ 2001-06-10 22:56 theonetruekenny
  0 siblings, 0 replies; 3+ messages in thread
From: theonetruekenny @ 2001-06-10 22:56 UTC (permalink / raw)
  To: gcc-gnats; +Cc: kenny.simpson

>Number:         3113
>Category:       libstdc++
>Synopsis:       DR 109: missing binders for non-const sequence elements
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jun 10 22:56:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     theonetruekenny@yahoo.com
>Release:        cvs 20010610
>Organization:
>Environment:
source
>Description:
see:
http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-active.html#109
>How-To-Repeat:
look in include/bits/stl_functional.h lines 202 and 227
>Fix:
add non-const operator() methods as per DR109
>Release-Note:
>Audit-Trail:
>Unformatted:


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

* Re: libstdc++/3113: DR 109: missing binders for non-const sequence elements
@ 2001-06-11 12:05 bkoz
  0 siblings, 0 replies; 3+ messages in thread
From: bkoz @ 2001-06-11 12:05 UTC (permalink / raw)
  To: bkoz, gcc-bugs, gcc-prs, kenny.simpson, theonetruekenny

Synopsis: DR 109: missing binders for non-const sequence elements

State-Changed-From-To: feedback->closed
State-Changed-By: bkoz
State-Changed-When: Mon Jun 11 12:05:21 2001
State-Changed-Why:
    Fixed.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3113&database=gcc


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

* Re: libstdc++/3113: DR 109: missing binders for non-const sequence elements
@ 2001-06-11 10:56 bkoz
  0 siblings, 0 replies; 3+ messages in thread
From: bkoz @ 2001-06-11 10:56 UTC (permalink / raw)
  To: bkoz, gcc-bugs, gcc-prs, kenny.simpson, nobody, theonetruekenny

Synopsis: DR 109: missing binders for non-const sequence elements

Responsible-Changed-From-To: unassigned->bkoz
Responsible-Changed-By: bkoz
Responsible-Changed-When: Mon Jun 11 10:56:25 2001
Responsible-Changed-Why:
    Mine.
State-Changed-From-To: open->feedback
State-Changed-By: bkoz
State-Changed-When: Mon Jun 11 10:56:25 2001
State-Changed-Why:
    Umm. Here's a testcase:
    
    #include <vector>
    #include <algorithm> // for_each
    #include <functional>
    
    class Elem 
    { 
    public: 
      void print(int i) const { } 
      void modify(int i) { } 
    }; 
    
    // libstdc++/3113
    void test01()
    { 
      std::vector<Elem> coll(2); 
      // OK 
      std::for_each(coll.begin(), coll.end(), 
    	   std::bind2nd(std::mem_fun_ref(&Elem::print), 42));
      // OK
      std::for_each(coll.begin(), coll.end(), 
    	   std::bind2nd(std::mem_fun_ref(&Elem::modify), 42));
    }
    
    
    int main()
    {
      test01();
      return 0;
    }
    
    making the following change:
    
    2001-06-11  benjamin kosnik  <bkoz@fillmore.constant.com>
    
    	libstdc++/3113
    	* include/bits/stl_function.h (binder2nd): Fix as per DR 109.
    	(binder1st): Same.
    	* include/bits/std_queue.h: Add c++config.h.
    
    Index: include/bits/std_queue.h
    ===================================================================
    RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/std_queue.h,v
    retrieving revision 1.3
    diff -c -p -r1.3 std_queue.h
    *** std_queue.h	2001/03/31 20:15:42	1.3
    --- std_queue.h	2001/06/11 17:54:46
    ***************
    *** 28,34 ****
      #define _CPP_QUEUE 1
      
      #pragma GCC system_header
    ! 
      #include <bits/stl_algobase.h>
      #include <bits/stl_alloc.h>
      #include <bits/stl_construct.h>
    --- 28,34 ----
      #define _CPP_QUEUE 1
      
      #pragma GCC system_header
    ! #include <bits/c++config.h>
      #include <bits/stl_algobase.h>
      #include <bits/stl_alloc.h>
      #include <bits/stl_construct.h>
    Index: include/bits/stl_function.h
    ===================================================================
    RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/stl_function.h,v
    retrieving revision 1.2
    diff -c -p -r1.2 stl_function.h
    *** stl_function.h	2001/03/04 21:34:01	1.2
    --- stl_function.h	2001/06/11 17:54:48
    *************** public:
    *** 199,204 ****
    --- 199,210 ----
        operator()(const typename _Operation::second_argument_type& __x) const {
          return op(value, __x); 
        }
    + #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
    +   // 109. Missing binders for non-const sequence elements
    +   operator()(typename _Operation::second_argument_type& __x) const {
    +     return op(value, __x); 
    +   }
    + #endif
      };
      
      template <class _Operation, class _Tp>
    *************** public:
    *** 224,229 ****
    --- 230,241 ----
        operator()(const typename _Operation::first_argument_type& __x) const {
          return op(__x, value); 
        }
    + #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
    +   // 109. Missing binders for non-const sequence elements
    +   operator()(typename _Operation::first_argument_type& __x) const {
    +     return op(__x, value); 
    +   }
    + #endif
      };
      
      template <class _Operation, class _Tp>
    
    
    Still doesn't make the above compile:
    
    %COMP.sh 3113.cc
    /mnt/hd/bliss/src.gcc/libstdc++-v3/include/bits/stl_function.h: In member 
       function `int std::binder2nd<_Operation>::operator()(typename 
       _Operation::first_argument_type&) const [with _Operation = 
       std::const_mem_fun1_ref_t<void, Elem, int>]':
    /mnt/hd/bliss/src.gcc/libstdc++-v3/include/bits/stl_algo.h:91:   instantiated from `_Function std::for_each(_InputIter, _InputIter, _Function) [with _InputIter = std::__normal_iterator<Elem*, std::vector<Elem, std::allocator<Elem> > >, _Function = std::binder2nd<std::const_mem_fun1_ref_t<void, Elem, int> >]'
    3113.cc:18:   instantiated from here
    /mnt/hd/bliss/src.gcc/libstdc++-v3/include/bits/stl_function.h:236: void value 
       not ignored as it ought to be
    /mnt/hd/bliss/src.gcc/libstdc++-v3/include/bits/stl_function.h: In member 
       function `int std::binder2nd<_Operation>::operator()(typename 
       _Operation::first_argument_type&) const [with _Operation = 
       std::mem_fun1_ref_t<void, Elem, int>]':
    /mnt/hd/bliss/src.gcc/libstdc++-v3/include/bits/stl_algo.h:91:   instantiated from `_Function std::for_each(_InputIter, _InputIter, _Function) [with _InputIter = std::__normal_iterator<Elem*, std::vector<Elem, std::allocator<Elem> > >, _Function = std::binder2nd<std::mem_fun1_ref_t<void, Elem, int> >]'
    3113.cc:21:   instantiated from here
    /mnt/hd/bliss/src.gcc/libstdc++-v3/include/bits/stl_function.h:236: void value 
       not ignored as it ought to be
    
    Not quite sure how to solve this last bit. However, the patch doesn't cause any other problems and so it likely to go in anyway.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3113&database=gcc


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

end of thread, other threads:[~2001-06-11 12:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-10 22:56 libstdc++/3113: DR 109: missing binders for non-const sequence elements theonetruekenny
2001-06-11 10:56 bkoz
2001-06-11 12:05 bkoz

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).