_Rb_tree regression

Jonathan Wakely jwakely@redhat.com
Wed Dec 14 11:27:00 GMT 2016


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)



More information about the Libstdc++ mailing list