diff mbox

_Rb_tree regression

Message ID 6b9e0075-8e40-e47b-9f63-7f79722e5a17@gmail.com
State New
Headers show

Commit Message

François Dumont Dec. 13, 2016, 9:51 p.m. UTC
Hi

     I have been reported privately by Christophe in copy a regression 
resulting from my recent changes to _Rb_tree. I removed a constructor 
still necessary in C++03 mode or before. Tests would have shown it if I 
had run them in C++03.

     * include/bits/stl_tree.h
     (_Rb_tree_impl(const _Key_compare&, const _Node_allocator&): Restore
     before C++11 mode.

     I prefer to restore it only before C++11 while it used to be 
available in any mode. It is only call with rvalue references. Don't 
hesitate to commit it yourself if you prefer to fix it quickly otherwise 
I'll do it after validation in about 24 hours.

François

Comments

Jonathan Wakely Dec. 14, 2016, 11:27 a.m. UTC | #1
On 13/12/16 22:51 +0100, François Dumont wrote:
>Hi

>

>    I have been reported privately by Christophe in copy a regression 

>resulting from my recent changes to _Rb_tree. I removed a constructor 

>still necessary in C++03 mode or before. Tests would have shown it if 

>I had run them in C++03.


For reference:

  make check RUNTESTFLAGS=--target_board=unix/-std=gnu++03

On trunk this will run almost the entire testsuite as C++03.

>    * include/bits/stl_tree.h

>    (_Rb_tree_impl(const _Key_compare&, const _Node_allocator&): Restore

>    before C++11 mode.

>

>    I prefer to restore it only before C++11 while it used to be 

>available in any mode. It is only call with rvalue references. Don't 


It's only called with *rvalues* (not rvalue references) but for C++11
and up we have a constructor taking an rvalue reference, so I agree
that the constructor taking a const lvalue reference is only needed
for C++03.

>hesitate to commit it yourself if you prefer to fix it quickly 

>otherwise I'll do it after validation in about 24 hours.


OK, thanks, please commit as soon as testing completes.


>François

>


>diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h

>index 1bfbfa7..cb2c116 100644

>--- a/libstdc++-v3/include/bits/stl_tree.h

>+++ b/libstdc++-v3/include/bits/stl_tree.h

>@@ -692,7 +692,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION

> 	  , _Base_key_compare(__x._M_key_compare)

> 	  { }

> 

>-#if __cplusplus >= 201103L

>+#if __cplusplus < 201103L

>+	  _Rb_tree_impl(const _Key_compare& __comp, const _Node_allocator& __a)

>+	  : _Node_allocator(__a), _Base_key_compare(__comp)

>+	  { }

>+#else

> 	  _Rb_tree_impl(_Rb_tree_impl&&) = default;

> 	  _Rb_tree_impl(const _Key_compare& __comp, _Node_allocator&& __a)

> 	  : _Node_allocator(std::move(__a)), _Base_key_compare(__comp)
Jonathan Wakely Dec. 14, 2016, 11:29 a.m. UTC | #2
On 14/12/16 11:27 +0000, Jonathan Wakely wrote:
>On 13/12/16 22:51 +0100, François Dumont wrote:

>>Hi

>>

>>   I have been reported privately by Christophe in copy a regression 

>>resulting from my recent changes to _Rb_tree. I removed a 

>>constructor still necessary in C++03 mode or before. Tests would 

>>have shown it if I had run them in C++03.

>

>For reference:

>

> make check RUNTESTFLAGS=--target_board=unix/-std=gnu++03

>

>On trunk this will run almost the entire testsuite as C++03.

>

>>   * include/bits/stl_tree.h

>>   (_Rb_tree_impl(const _Key_compare&, const _Node_allocator&): Restore

>>   before C++11 mode.

>>

>>   I prefer to restore it only before C++11 while it used to be 

>>available in any mode. It is only call with rvalue references. Don't

>

>It's only called with *rvalues* (not rvalue references) but for C++11

>and up we have a constructor taking an rvalue reference, so I agree

>that the constructor taking a const lvalue reference is only needed

>for C++03.

>

>>hesitate to commit it yourself if you prefer to fix it quickly 

>>otherwise I'll do it after validation in about 24 hours.

>

>OK, thanks, please commit as soon as testing completes.

>

>

>>François

>>

>

>>diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h

>>index 1bfbfa7..cb2c116 100644

>>--- a/libstdc++-v3/include/bits/stl_tree.h

>>+++ b/libstdc++-v3/include/bits/stl_tree.h

>>@@ -692,7 +692,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION

>>	  , _Base_key_compare(__x._M_key_compare)

>>	  { }

>>

>>-#if __cplusplus >= 201103L

>>+#if __cplusplus < 201103L

>>+	  _Rb_tree_impl(const _Key_compare& __comp, const _Node_allocator& __a)

>>+	  : _Node_allocator(__a), _Base_key_compare(__comp)

>>+	  { }

>>+#else

>>	  _Rb_tree_impl(_Rb_tree_impl&&) = default;


Please also add a blank line here, between these two constructors.

>>	  _Rb_tree_impl(const _Key_compare& __comp, _Node_allocator&& __a)

>>	  : _Node_allocator(std::move(__a)), _Base_key_compare(__comp)

>
Jonathan Wakely Dec. 14, 2016, 11:36 a.m. UTC | #3
On 14/12/16 11:27 +0000, Jonathan Wakely wrote:
>On 13/12/16 22:51 +0100, François Dumont wrote:

>>Hi

>>

>>   I have been reported privately by Christophe in copy a regression 

>>resulting from my recent changes to _Rb_tree. I removed a 

>>constructor still necessary in C++03 mode or before. Tests would 

>>have shown it if I had run them in C++03.

>

>For reference:

>

> make check RUNTESTFLAGS=--target_board=unix/-std=gnu++03

>

>On trunk this will run almost the entire testsuite as C++03.

>

>>   * include/bits/stl_tree.h

>>   (_Rb_tree_impl(const _Key_compare&, const _Node_allocator&): Restore

>>   before C++11 mode.

>>

>>   I prefer to restore it only before C++11 while it used to be 

>>available in any mode. It is only call with rvalue references. Don't

>

>It's only called with *rvalues* (not rvalue references) but for C++11

>and up we have a constructor taking an rvalue reference, so I agree

>that the constructor taking a const lvalue reference is only needed

>for C++03.

>

>>hesitate to commit it yourself if you prefer to fix it quickly 

>>otherwise I'll do it after validation in about 24 hours.

>

>OK, thanks, please commit as soon as testing completes.


I've confirmed that the change fixes these bad test results for C++03
testing:

UNRESOLVED:     12
FAIL:   32
François Dumont Dec. 14, 2016, 8:51 p.m. UTC | #4
On 14/12/2016 12:36, Jonathan Wakely wrote:
> On 14/12/16 11:27 +0000, Jonathan Wakely wrote:

>> On 13/12/16 22:51 +0100, François Dumont wrote:

> I've confirmed that the change fixes these bad test results for C++03

> testing:

>

> UNRESOLVED:     12

> FAIL:   32

>


Thanks for confirming, now committed.

François
diff mbox

Patch

diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h
index 1bfbfa7..cb2c116 100644
--- a/libstdc++-v3/include/bits/stl_tree.h
+++ b/libstdc++-v3/include/bits/stl_tree.h
@@ -692,7 +692,11 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	  , _Base_key_compare(__x._M_key_compare)
 	  { }
 
-#if __cplusplus >= 201103L
+#if __cplusplus < 201103L
+	  _Rb_tree_impl(const _Key_compare& __comp, const _Node_allocator& __a)
+	  : _Node_allocator(__a), _Base_key_compare(__comp)
+	  { }
+#else
 	  _Rb_tree_impl(_Rb_tree_impl&&) = default;
 	  _Rb_tree_impl(const _Key_compare& __comp, _Node_allocator&& __a)
 	  : _Node_allocator(std::move(__a)), _Base_key_compare(__comp)