Patchwork [v3] fix libstdc++/53027

login
register
mail settings
Submitter Jonathan Wakely
Date April 22, 2012, 1:44 p.m.
Message ID <CAH6eHdRRc97vACh6VqKMyhvbB9LSQ=DWd=z1idamr3Qe1wxgZQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/154269/
State New
Headers show

Comments

Jonathan Wakely - April 22, 2012, 1:44 p.m.
* include/bits/ptr_traits.h (pointer_traits::rebind): Make public.
        * testsuite/20_util/pointer_traits/requirements/typedefs.cc: Check
        rebind works.

Tested x86_64linux, committed to trunk and will commit to 4.7 soon.
commit 6141cdceb14025ef258b8809301558f5962bf7ab
Author: Jonathan Wakely <jwakely.gcc@gmail.com>
Date:   Fri Apr 20 09:13:44 2012 +0100

    	* include/bits/ptr_traits.h (pointer_traits::rebind): Make public.
    	* testsuite/20_util/pointer_traits/requirements/typedefs.cc: Check
    	rebind works.

Patch

diff --git a/libstdc++-v3/include/bits/ptr_traits.h b/libstdc++-v3/include/bits/ptr_traits.h
index 7f120b1..bba9b49 100644
--- a/libstdc++-v3/include/bits/ptr_traits.h
+++ b/libstdc++-v3/include/bits/ptr_traits.h
@@ -140,14 +140,8 @@  _GLIBCXX_HAS_NESTED_TYPE(difference_type)
       /// Type used to represent the difference between two pointers
       typedef typename __ptrtr_diff_type<_Ptr>::__type  difference_type;
 
-    private:
       template<typename _Up>
         using rebind = typename __ptrtr_rebind<_Ptr, _Up>::__type;
-
-      // allocator_traits needs to use __rebind
-      template<typename> friend struct allocator_traits;
-      template<typename> friend struct pointer_traits;
-      template<typename, typename> friend class __ptrtr_rebind_helper2;
     };
 
   /**
diff --git a/libstdc++-v3/testsuite/20_util/pointer_traits/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/pointer_traits/requirements/typedefs.cc
index c682557..47b5212 100644
--- a/libstdc++-v3/testsuite/20_util/pointer_traits/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/20_util/pointer_traits/requirements/typedefs.cc
@@ -32,6 +32,7 @@  void test01()
   typedef typename test_type::pointer           pointer;
   typedef typename test_type::element_type      element_type;
   typedef typename test_type::difference_type   difference_type;
+  typedef typename test_type::template rebind<char> rebind_type;
 }
 
 int main()