[ https://issues.apache.org/jira/browse/STDCXX-976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12611200#action_12611200 ]
sebor edited comment on STDCXX-976 at 7/7/08 8:22 AM: ------------------------------------------------------------- Crud. [r526954|http://svn.apache.org/viewvc?rev=526954&view=rev] is a fix for STDCXX-390. Your patch reverts the fix. What do you suggest we do about STDCXX-390 then? Add {{volatile}} and {{const volatile}} overloads? was (Author: sebor): Crud. [r526954|http://svn.apache.org/viewvc?rev=526954&view=rev] is a fix for STDCXX-390. Your patch reverts the fix. What do you suggest we do about STDCXX-390 then? > std::uninitialized_copy() requires InputIterator::operator*() returning lvalue > ------------------------------------------------------------------------------ > > Key: STDCXX-976 > URL: https://issues.apache.org/jira/browse/STDCXX-976 > Project: C++ Standard Library > Issue Type: Bug > Components: 25. Algorithms > Affects Versions: 4.2.0, 4.2.1 > Environment: All > Reporter: Farid Zaripov > Assignee: Farid Zaripov > Fix For: 4.2.2 > > Original Estimate: 1h > Remaining Estimate: 1h > > The following test fails to compile: > {code} > #include <memory> > #include <iterator> > struct InputIterator: std::iterator<std::input_iterator_tag, char> > { > const char *p_; > InputIterator (const char *p): p_ (p) { } > InputIterator (const InputIterator &rhs): p_ (rhs.p_) { } > InputIterator& operator= (const InputIterator &rhs) > { p_ = rhs.p_; return *this; } > char operator* () const { return *p_; } > > InputIterator& operator++ () { return ++p_, *this; } > InputIterator operator++ (int) { > return ++p_, InputIterator (p_ - 1); > } > bool operator== (const InputIterator &rhs) const { return p_ == rhs.p_; } > bool operator!= (const InputIterator &rhs) const { return p_ != rhs.p_; } > }; > int main () > { > char src [5] = "abcd"; > char dst [5]; > std::uninitialized_copy (InputIterator (src), InputIterator (src + 5), > dst); > return 0; > } > {code} > {noformat} > D:\_Libs\stdcxx-4.2.2\include\rw\_specialized.h(168) : error C2665: > '__rw::__rw_construct' : none of the 2 overloads can convert parameter 2 from > type 'char' > D:\_Libs\stdcxx-4.2.2\include\rw\_specialized.h(88): could be 'void > __rw::__rw_construct<char,char>(_TypeT *,_TypeU &)' > with > [ > _TypeT=char, > _TypeU=char > ] > D:\_Libs\stdcxx-4.2.2\include\rw\_specialized.h(96): or 'void > __rw::__rw_construct<char,char>(volatile _TypeT *,_TypeU &)' > with > [ > _TypeT=char, > _TypeU=char > ] > while trying to match the argument list '(char *, char)' > test.cpp(29) : see reference to function template instantiation > '_ForwardIterator > std::uninitialized_copy<InputIterator,char*>(_InputIterator,_InputIterator,_ForwardIterator)' > being compiled > with > [ > _ForwardIterator=char *, > _InputIterator=InputIterator > ] > {noformat} > The fix: > {noformat} > Index: include/rw/_specialized.h > =================================================================== > --- include/rw/_specialized.h (revision 671890) > +++ include/rw/_specialized.h (working copy) > @@ -85,7 +85,7 @@ > > template <class _TypeT, class _TypeU> > inline void > -__rw_construct (_TypeT* __p, _TypeU& __val) > +__rw_construct (_TypeT* __p, const _TypeU& __val) > { > ::new (_RWSTD_STATIC_CAST (void*, __p)) _TypeT (__val); > } > @@ -93,7 +93,7 @@ > > template <class _TypeT, class _TypeU> > inline void > -__rw_construct (volatile _TypeT* __p, _TypeU& __val) > +__rw_construct (volatile _TypeT* __p, const _TypeU& __val) > { > // remove volatile before invoking operator new > __rw_construct (_RWSTD_CONST_CAST (_TypeT*, __p), __val); > @@ -103,7 +103,7 @@ > > template <class _TypeT, class _TypeU> > inline void > -__rw_construct_impl (_TypeT* __p, _TypeU& __val) > +__rw_construct_impl (_TypeT* __p, const _TypeU& __val) > { > ::new (_RWSTD_STATIC_CAST (void*, __p)) _TypeT (__val); > } > @@ -111,7 +111,7 @@ > > template <class _TypeT, class _TypeU> > inline void > -__rw_construct (volatile _TypeT* __p, _TypeU& __val) > +__rw_construct (volatile _TypeT* __p, const _TypeU& __val) > { > // remove volatile before invoking operator new > __rw_construct_impl (_RWSTD_CONST_CAST (_TypeT*, __p), __val); > {noformat} -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.