[v3 PATCH] Implement C++17 GB50 resolution

Jonathan Wakely jwakely@redhat.com
Sun Feb 19 16:09:00 GMT 2017


On 18/02/17 20:48 +0000, Dinka Ranns wrote:
>Comments addressed. Please find the new diff attached to this e-mail.
>
>Changelog after review comments :
>
>2017-02-18 Dinka Ranns <dinka.ranns@googlemail.com>

GNU ChangeLog rules say two spaces after the date and after your name.

>        C++17 GB50 resolution
>        * include/std/chrono:
>        (duration::operator++()): Add _GLIBCXX17_CONSTEXPR.
>        (duration::operator++(int)): Likewise
>        (duration::operator--()): Likewise
>        (duration::operator--(int)): Likewise
>        (duration::operator+=(const duration&)): Likewise
>        (duration::operator-=(const duration&)): Likewise
>        (duration::operator*=(const rep&)): Likewise
>        (duration::operator/=(const rep&)): Likewise
>        (duration::operator%=(const rep&)): Likewise
>        (duration::operator%=(const duration&)): Likewise
>        (time_point::operator+=(const duration&)): Likewise
>        (time_point::operator-=(const duration&)): Likewise
>
>        * testsuite/20_util/duration/arithmetic/constexpr_c++17.cc: new tests
>        * testsuite/20_util/time_point/arithmetic/constexpr.cc: new tests

I also tweaked the ChangeLog entry to add some full stops.

>@@ -401,7 +401,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
>
> 	// DR 934.
> 	template<typename _Rep2 = rep>
>-	  typename enable_if<!treat_as_floating_point<_Rep2>::value,
>+	  _GLIBCXX17_CONSTEXPR typename enable_if<!treat_as_floating_point<_Rep2>::value,
> 			     duration&>::type
> 	  operator%=(const rep& __rhs)
> 	  {
>@@ -410,7 +410,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
> 	  }
>
> 	template<typename _Rep2 = rep>
>-	  typename enable_if<!treat_as_floating_point<_Rep2>::value,
>+	  _GLIBCXX17_CONSTEXPR typename enable_if<!treat_as_floating_point<_Rep2>::value,
> 			     duration&>::type
> 	  operator%=(const duration& __d)
> 	  {

I added line breaks to these two signatures to keep the line shorter
than 80 columns, and to keep the "duration&" lined up with the first
argument to enable_if. That meant 20_util/duration/literals/range.cc
started to FAIL because the expected error was on a different line, so
I adjusted that test. 

The attached patch includes those tweaks and is what I've tested and
committed. Thanks for your first contribution to libstdc++!


-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 6615 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20170219/3607995b/attachment.bin>


More information about the Gcc-patches mailing list