Created: (STDCXX-976) std::uninitialized_copy() requires InputIterator::operator*() returning lvalue

View: New views
19 Messages — Rating Filter:   Alert me  

Created: (STDCXX-976) std::uninitialized_copy() requires InputIterator::operator*() returning lvalue

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.1, 4.2.0, 4.1.4, 4.1.3
         Environment: All
            Reporter: Farid Zaripov
            Assignee: Farid Zaripov
             Fix For: 4.2.2


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.


Updated: (STDCXX-976) std::uninitialized_copy() requires InputIterator::operator*() returning lvalue

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ https://issues.apache.org/jira/browse/STDCXX-976?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Farid Zaripov updated STDCXX-976:
---------------------------------

           Regression: [Regression]
    Affects Version/s:     (was: 4.1.4)
                           (was: 4.1.3)

4.1.x versions are not affected by this issue, since the problem introduced in [r526954|https://svn.apache.org/viewvc?rev=526954&view=rev]

Making the issue as regression.


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


Commented: (STDCXX-976) std::uninitialized_copy() requires InputIterator::operator*() returning lvalue

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/STDCXX-976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12611200#action_12611200 ]

Martin Sebor commented on STDCXX-976:
-------------------------------------

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.


Issue Comment Edited: (STDCXX-976) std::uninitialized_copy() requires InputIterator::operator*() returning lvalue

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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


Commented: (STDCXX-976) std::uninitialized_copy() requires InputIterator::operator*() returning lvalue

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/STDCXX-976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12611244#action_12611244 ]

Farid Zaripov commented on STDCXX-976:
--------------------------------------

I suggest to not use __rw_construct() from uninitialized_copy() and call placement operator new right in place.

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


Assigned: (STDCXX-976) std::uninitialized_copy() requires InputIterator::operator*() returning lvalue

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ https://issues.apache.org/jira/browse/STDCXX-976?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Farid Zaripov reassigned STDCXX-976:
------------------------------------

    Assignee:     (was: Farid Zaripov)

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


Commented: (STDCXX-976) std::uninitialized_copy() requires InputIterator::operator*() returning lvalue

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/STDCXX-976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12611246#action_12611246 ]

Farid Zaripov commented on STDCXX-976:
--------------------------------------

Removed assignment on me, because I will be out of project for 3 weeks.

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


Assigned: (STDCXX-976) std::uninitialized_copy() requires InputIterator::operator*() returning lvalue

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ https://issues.apache.org/jira/browse/STDCXX-976?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Farid Zaripov reassigned STDCXX-976:
------------------------------------

    Assignee: Farid Zaripov

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


Commented: (STDCXX-976) std::uninitialized_copy() requires InputIterator::operator*() returning lvalue

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/STDCXX-976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12618636#action_12618636 ]

Farid Zaripov commented on STDCXX-976:
--------------------------------------

How about this patch? Could someone verify this change on HP aCC 3.73?

{noformat}
Index: include/rw/_specialized.h
===================================================================
--- include/rw/_specialized.h (revision 681301)
+++ include/rw/_specialized.h (working copy)
@@ -52,6 +52,11 @@
 #endif   // _RWSTD_RW_NEW_H_INCLUDED
 
 
+#ifndef _RWSTD_RW_ITERBASE_H_INCLUDED
+#  include <rw/_iterbase.h>
+#endif   // _RWSTD_RW_ITERBASE_H_INCLUDED
+
+
 _RWSTD_NAMESPACE (__rw) {
 
 
@@ -162,10 +167,11 @@
                     _ForwardIterator __res)
 {
     const _ForwardIterator __start = __res;
+    typedef const _TYPENAME iterator_traits<_InputIterator>::value_type& _RefT;
 
     _TRY {
         for (; __first != __last; ++__first, ++__res)
-            _RW::__rw_construct (&*__res, *__first);
+            _RW::__rw_construct (&*__res, _RefT (*__first));
     }
     _CATCH (...) {
         _RW::__rw_destroy (__start, __res);
{noformat}

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


Commented: (STDCXX-976) std::uninitialized_copy() requires InputIterator::operator*() returning lvalue

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/STDCXX-976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12618639#action_12618639 ]

Farid Zaripov commented on STDCXX-976:
--------------------------------------

The regression test added thus: http://svn.apache.org/viewvc?rev=681328&view=rev

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


Commented: (STDCXX-976) std::uninitialized_copy() requires InputIterator::operator*() returning lvalue

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/STDCXX-976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12618716#action_12618716 ]

Martin Sebor commented on STDCXX-976:
-------------------------------------

It compiles fine with aCC 3.73. Unfortunately, after the patch compiler chokes on the regression test for STDCXX-390: [20.specialized.stdcxx-390.cpp|http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/regress/20.specialized.stdcxx-390.cpp?view=markup]
{noformat}
aCC -c  -D_RWSTDDEBUG   -mt -I/tmp_mnt/amd/devco/sebor/stdcxx-4.2.x/include -I/build/sebor/stdcxx-4.2.x-aCC-3.73-15D/include -I/tmp_mnt/amd/devco/sebor/stdcxx-4.2.x/tests/include  -AA  -g +d  +DD64 +w +W392,655,684,818,819,849   /tmp_mnt/amd/devco/sebor/stdcxx-4.2.x/tests/regress/20.specialized.stdcxx-390.cpp
( 0)  0x002a6480   toolError__12ErrorHandlerF11StringTokenRC8Positione + 0x58  [/tmp_mnt/amd/packages/mdx/hpux/compilers/hp/aCC373_11.11/opt/aCC/lbin/ctcom.pa20]
( 1)  0x00354640   fe_error + 0x24c  [/tmp_mnt/amd/packages/mdx/hpux/compilers/hp/aCC373_11.11/opt/aCC/lbin/ctcom.pa20]
( 2)  0x0088b614   add_ELF_comdat_entry + 0x13c  [/tmp_mnt/amd/packages/mdx/hpux/compilers/hp/aCC373_11.11/opt/aCC/lbin/ctcom.pa20]
( 3)  0x0088b690   collect_ELF_comdats + 0x4c  [/tmp_mnt/amd/packages/mdx/hpux/compilers/hp/aCC373_11.11/opt/aCC/lbin/ctcom.pa20]
( 4)  0x0088e258   close_ELF_link + 0xa0  [/tmp_mnt/amd/packages/mdx/hpux/compilers/hp/aCC373_11.11/opt/aCC/lbin/ctcom.pa20]
( 5)  0x000b7bc4   end_out + 0x3c  [/tmp_mnt/amd/packages/mdx/hpux/compilers/hp/aCC373_11.11/opt/aCC/lbin/ctcom.pa20]
( 6)  0x001047b0   pass3_sllic + 0xf0  [/tmp_mnt/amd/packages/mdx/hpux/compilers/hp/aCC373_11.11/opt/aCC/lbin/ctcom.pa20]
( 7)  0x001046b4   ccall_pass3 + 0x20  [/tmp_mnt/amd/packages/mdx/hpux/compilers/hp/aCC373_11.11/opt/aCC/lbin/ctcom.pa20]
( 8)  0x00113bd0   process_sllic_graph + 0x1f0  [/tmp_mnt/amd/packages/mdx/hpux/compilers/hp/aCC373_11.11/opt/aCC/lbin/ctcom.pa20]
( 9)  0x00281c30   finish_program + 0x94  [/tmp_mnt/amd/packages/mdx/hpux/compilers/hp/aCC373_11.11/opt/aCC/lbin/ctcom.pa20]
(10)  0x00282ff4   cg_stp + 0x178  [/tmp_mnt/amd/packages/mdx/hpux/compilers/hp/aCC373_11.11/opt/aCC/lbin/ctcom.pa20]
(11)  0x003773e4   be_stp + 0x1c  [/tmp_mnt/amd/packages/mdx/hpux/compilers/hp/aCC373_11.11/opt/aCC/lbin/ctcom.pa20]
(12)  0x000b73ec   ucodeCodeGenTerm__Fv + 0x78  [/tmp_mnt/amd/packages/mdx/hpux/compilers/hp/aCC373_11.11/opt/aCC/lbin/ctcom.pa20]
(13)  0x000cb7ac   main + 0x46c  [/tmp_mnt/amd/packages/mdx/hpux/compilers/hp/aCC373_11.11/opt/aCC/lbin/ctcom.pa20]
(14)  0xc0143b00   _start + 0xc4  [/usr/lib/libc.2]
(15)  0x000b8120   $START$ + 0x178  [/tmp_mnt/amd/packages/mdx/hpux/compilers/hp/aCC373_11.11/opt/aCC/lbin/ctcom.pa20]
Error (internal problem) 7835: Exact position unknown; near
    ["/build/sebor/stdcxx-4.2.x-aCC-3.73-15D/include/config.h", line 805]. #
    Internal error encountered while generating ELF file. (7835)
gmake: *** [20.specialized.stdcxx-390.o] Error 3
{noformat}

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


Commented: (STDCXX-976) std::uninitialized_copy() requires InputIterator::operator*() returning lvalue

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/STDCXX-976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12624377#action_12624377 ]

Farid Zaripov commented on STDCXX-976:
--------------------------------------

Fixed in 4.2.x branch for all compilers, except HP aCC thus: http://svn.apache.org/viewvc?rev=687762&view=rev

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


Commented: (STDCXX-976) std::uninitialized_copy() requires InputIterator::operator*() returning lvalue

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/STDCXX-976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12624652#action_12624652 ]

Farid Zaripov commented on STDCXX-976:
--------------------------------------

The [http://svn.apache.org/viewvc?rev=687762&view=rev|latest change] is not enough - see the updated testcase http://svn.apache.org/viewvc?rev=688053&view=rev

We shouldn't use const reference if the _InputIterator::operator*() returns non-const reference.

The possible solutions are:
1. Add const _TypeU& overloads of the __rw_construct()
2. Use placement new right in std::uninitialized_copy() instead of using __rw_construct()

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


Issue Comment Edited: (STDCXX-976) std::uninitialized_copy() requires InputIterator::operator*() returning lvalue

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/STDCXX-976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12624652#action_12624652 ]

farid edited comment on STDCXX-976 at 8/22/08 4:13 AM:
---------------------------------------------------------------

The [latest change|http://svn.apache.org/viewvc?rev=687762&view=rev] is not enough - see the updated testcase http://svn.apache.org/viewvc?rev=688053&view=rev

We shouldn't use const reference if the _InputIterator::operator*() returns non-const reference.

The possible solutions are:
1. Add const _TypeU& overloads of the __rw_construct()
2. Use placement new right in std::uninitialized_copy() instead of using __rw_construct()

      was (Author: farid):
    The [http://svn.apache.org/viewvc?rev=687762&view=rev|latest change] is not enough - see the updated testcase http://svn.apache.org/viewvc?rev=688053&view=rev

We shouldn't use const reference if the _InputIterator::operator*() returns non-const reference.

The possible solutions are:
1. Add const _TypeU& overloads of the __rw_construct()
2. Use placement new right in std::uninitialized_copy() instead of using __rw_construct()
 

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


Commented: (STDCXX-976) std::uninitialized_copy() requires InputIterator::operator*() returning lvalue

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/STDCXX-976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12629222#action_12629222 ]

Farid Zaripov commented on STDCXX-976:
--------------------------------------

The regression test merged in trunk and 4.3.x branch thus:
http://svn.apache.org/viewvc?view=rev&revision=693160
http://svn.apache.org/viewvc?view=rev&revision=693161

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


Commented: (STDCXX-976) std::uninitialized_copy() requires InputIterator::operator*() returning lvalue

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/STDCXX-976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12633366#action_12633366 ]

Farid Zaripov commented on STDCXX-976:
--------------------------------------

??citation??
The possible solutions are:
1. Add const _TypeU& overloads of the __rw_construct()
2. Use placement new right in std::uninitialized_copy() instead of using __rw_construct()
??citation??

The first solution doesn't work on gcc.
The second solution committed thus:  http://svn.apache.org/viewvc?view=rev&revision=697885

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


Issue Comment Edited: (STDCXX-976) std::uninitialized_copy() requires InputIterator::operator*() returning lvalue

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/STDCXX-976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12633366#action_12633366 ]

farid edited comment on STDCXX-976 at 9/22/08 9:16 AM:
---------------------------------------------------------------

{quote}
The possible solutions are:
1. Add const _TypeU& overloads of the __rw_construct()
2. Use placement new right in std::uninitialized_copy() instead of using __rw_construct()
{quote}

The first solution doesn't work on gcc.
The second solution committed thus:  http://svn.apache.org/viewvc?view=rev&revision=697885

      was (Author: farid):
    ??citation??
The possible solutions are:
1. Add const _TypeU& overloads of the __rw_construct()
2. Use placement new right in std::uninitialized_copy() instead of using __rw_construct()
??citation??

The first solution doesn't work on gcc.
The second solution committed thus:  http://svn.apache.org/viewvc?view=rev&revision=697885
 

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


Closed: (STDCXX-976) std::uninitialized_copy() requires InputIterator::operator*() returning lvalue

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ https://issues.apache.org/jira/browse/STDCXX-976?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Farid Zaripov closed STDCXX-976.
--------------------------------


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


Resolved: (STDCXX-976) std::uninitialized_copy() requires InputIterator::operator*() returning lvalue

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ https://issues.apache.org/jira/browse/STDCXX-976?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Farid Zaripov resolved STDCXX-976.
----------------------------------

    Resolution: Fixed

Resolved int 4.2.x branch thus http://svn.apache.org/viewvc?view=rev&revision=697885 and http://svn.apache.org/viewvc?view=rev&revision=704366

Merged into trunk and 4.3.x branch thus:
http://svn.apache.org/viewvc?view=rev&revision=704438
http://svn.apache.org/viewvc?view=rev&revision=704442


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