diff mbox

Implement move semantics for iostreams

Message ID 20140924094009.GR2669@redhat.com
State New
Headers show

Commit Message

Jonathan Wakely Sept. 24, 2014, 9:40 a.m. UTC
On 22/09/14 14:35 +0100, Jonathan Wakely wrote:
>This adds move and swap functions to the iostream classes.

This fixes a silly typo.

Tested x86_64-linux, committed to trunk.

Comments

Jakub Jelinek Sept. 24, 2014, 10:01 a.m. UTC | #1
On Wed, Sep 24, 2014 at 10:40:09AM +0100, Jonathan Wakely wrote:
> On 22/09/14 14:35 +0100, Jonathan Wakely wrote:
> >This adds move and swap functions to the iostream classes.
> 
> This fixes a silly typo.
> 
> Tested x86_64-linux, committed to trunk.
> 

> commit acaef9854dff5f37d86b80fc8236df5fd90b0ca5
> Author: Jonathan Wakely <jwakely@redhat.com>
> Date:   Wed Sep 24 10:10:28 2014 +0100
> 
>     	PR libstdc++/63353
>     	* src/c++11/ios.cc (ios_base::_M_swap): Fix typo.
> 
> diff --git a/libstdc++-v3/src/c++11/ios.cc b/libstdc++-v3/src/c++11/ios.cc
> index b5124ec..0e136d4 100644
> --- a/libstdc++-v3/src/c++11/ios.cc
> +++ b/libstdc++-v3/src/c++11/ios.cc
> @@ -229,7 +229,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>       std::swap(_M_local_word, __rhs._M_local_word); // array swap
>      else
>       {
> -       if (!__lhs_local && !__lhs_local)
> +       if (!__lhs_local && !__rhs_local)
>  	 std::swap(_M_word, __rhs._M_word);
>         else
>  	 {

Wouldn't this be something for a (non-Wall?) warning?
I mean if && or || contains the same conditions, perhaps we should
warn.

	Jakub
Marek Polacek Sept. 24, 2014, 10:26 a.m. UTC | #2
On Wed, Sep 24, 2014 at 12:01:13PM +0200, Jakub Jelinek wrote:
> > -       if (!__lhs_local && !__lhs_local)
> > +       if (!__lhs_local && !__rhs_local)
> >  	 std::swap(_M_word, __rhs._M_word);
> >         else
> >  	 {
> 
> Wouldn't this be something for a (non-Wall?) warning?
> I mean if && or || contains the same conditions, perhaps we should
> warn.

Yeah, I think it'd make sense to warn.  I don't think we have an
option for this (-Wlogical-op does something little bit different).
Hence:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63357

	Marek
diff mbox

Patch

commit acaef9854dff5f37d86b80fc8236df5fd90b0ca5
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Sep 24 10:10:28 2014 +0100

    	PR libstdc++/63353
    	* src/c++11/ios.cc (ios_base::_M_swap): Fix typo.

diff --git a/libstdc++-v3/src/c++11/ios.cc b/libstdc++-v3/src/c++11/ios.cc
index b5124ec..0e136d4 100644
--- a/libstdc++-v3/src/c++11/ios.cc
+++ b/libstdc++-v3/src/c++11/ios.cc
@@ -229,7 +229,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
      std::swap(_M_local_word, __rhs._M_local_word); // array swap
     else
      {
-       if (!__lhs_local && !__lhs_local)
+       if (!__lhs_local && !__rhs_local)
 	 std::swap(_M_word, __rhs._M_word);
        else
 	 {