Patchwork RFA (libstdc++): C++/v3 PATCH for c++/24163 (lookup in dependent bases) and c++/29131

login
register
mail settings
Submitter Jonathan Wakely
Date May 27, 2011, 8:30 a.m.
Message ID <BANLkTi=4+SxZ1+wJbjZkGXEjy28YZsKLYQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/97662/
State New
Headers show

Comments

Jonathan Wakely - May 27, 2011, 8:30 a.m.
On 20 May 2011 17:32, Jason Merrill wrote:
> G++ has had a long-standing bug with unqualified name resolution in
> templates: if we didn't find any declaration when looking up a name in the
> template definition, we would do an additional unqualified lookup at the
> point of instantiation.  This led to incorrectly finding namespace-scope
> functions declared later (29131) and member functions of dependent bases
> (24163).  This patch fixes that bug.
>
> To be friendly to users, the patch also allows affected code to compile with
> -fpermissive and provides suggestions about how to fix the code: either
> declaring the desired function earlier (29131) or explicitly qualifying the
> name with this-> or Class:: (24163).
>
> This caused a lot of regressions in the libstdc++ testsuite, which I've
> fixed.  To find names in dependent bases, I've added explicit this-> in
> non-static member functions, and explicit Class:: in static member
> functions.  I'd like confirmation from the library folks that this is the
> style they want to use for this.
>
> There were also a couple of issues with calls to functions that hadn't been
> declared yet; library folks should definitely check my formatting on the
> forward declarations I've added, for mem_fn in functional and for
> __expint_E1 in exp_integral.tcc.
>
> Tested x86_64-pc-linux-gnu.  Are the library changes OK for trunk?
>

I think this piece is also needed due to the fix for 29131:


That only shows up if you configure with --enable-libstcxx-time

I'll finish reg-testing it and submit it when I get home this evening.
Paolo Carlini - May 27, 2011, 9:05 a.m.
Hi,
> That only shows up if you configure with --enable-libstcxx-time
>
> I'll finish reg-testing it and submit it when I get home this evening.
thanks Jon. Looks like we have also to fix parallel-mode (49187), I hope 
there isn't too much to reshuffle, if you spot something...

Thanks again,
Paolo.
Jonathan Wakely - May 27, 2011, 9:38 p.m.
On 27 May 2011 09:30, Jonathan Wakely wrote:
>
> I think this piece is also needed due to the fix for 29131:
>
> Index: include/std/thread
> ===================================================================
> --- include/std/thread  (revision 174307)
> +++ include/std/thread  (working copy)
> @@ -260,12 +260,6 @@
>  #endif
>
>  #ifdef _GLIBCXX_USE_NANOSLEEP
> -    /// sleep_until
> -    template<typename _Clock, typename _Duration>
> -      inline void
> -      sleep_until(const chrono::time_point<_Clock, _Duration>& __atime)
> -      { sleep_for(__atime - _Clock::now()); }
> -
>     /// sleep_for
>     template<typename _Rep, typename _Period>
>       inline void
> @@ -285,6 +279,12 @@
>
>        ::nanosleep(&__ts, 0);
>       }
> +
> +    /// sleep_until
> +    template<typename _Clock, typename _Duration>
> +      inline void
> +      sleep_until(const chrono::time_point<_Clock, _Duration>& __atime)
> +      { sleep_for(__atime - _Clock::now()); }
>  #endif
>
>   _GLIBCXX_END_NAMESPACE_VERSION
>
> That only shows up if you configure with --enable-libstcxx-time
>
> I'll finish reg-testing it and submit it when I get home this evening.
>

2011-05-27  Jonathan Wakely  <jwakely.gcc@gmail.com>

        * include/std/thread (this_thread::sleep_until): Move after sleep_for.

Committed to trunk

Patch

Index: include/std/thread
===================================================================
--- include/std/thread  (revision 174307)
+++ include/std/thread  (working copy)
@@ -260,12 +260,6 @@ 
 #endif

 #ifdef _GLIBCXX_USE_NANOSLEEP
-    /// sleep_until
-    template<typename _Clock, typename _Duration>
-      inline void
-      sleep_until(const chrono::time_point<_Clock, _Duration>& __atime)
-      { sleep_for(__atime - _Clock::now()); }
-
     /// sleep_for
     template<typename _Rep, typename _Period>
       inline void
@@ -285,6 +279,12 @@ 

        ::nanosleep(&__ts, 0);
       }
+
+    /// sleep_until
+    template<typename _Clock, typename _Duration>
+      inline void
+      sleep_until(const chrono::time_point<_Clock, _Duration>& __atime)
+      { sleep_for(__atime - _Clock::now()); }
 #endif

   _GLIBCXX_END_NAMESPACE_VERSION