]> gcc.gnu.org Git - gcc.git/commitdiff
libstdc++: Avoid narrowing conversion in subrange constructor
authorJonathan Wakely <jwakely@redhat.com>
Thu, 29 Oct 2020 22:47:22 +0000 (22:47 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 29 Oct 2020 22:47:22 +0000 (22:47 +0000)
libstdc++-v3/ChangeLog:

* include/bits/ranges_util.h (subrange::subrange(R&&)): Use
direct-initialization instead of list-initialization, so a
potential narrowing conversion from ranges::size(r) to the
stored size isn't ill-formed.

libstdc++-v3/include/bits/ranges_util.h

index cc50e2ad4e42311d451490aa7ae9a7a0e3c0fcb9..416c334625412a542098639f3635fab34bd1cfe2 100644 (file)
@@ -247,7 +247,7 @@ namespace ranges
          && convertible_to<sentinel_t<_Rng>, _Sent>
        constexpr
        subrange(_Rng&& __r) requires _S_store_size && sized_range<_Rng>
-       : subrange{__r, ranges::size(__r)}
+       : subrange(__r, ranges::size(__r))
        { }
 
       template<__detail::__not_same_as<subrange> _Rng>
This page took 0.065705 seconds and 5 git commands to generate.