• Raul Tambre's avatar
    checked_range: Disambiguate base::size()/data() · 78ac5c8b
    Raul Tambre authored
    ../../base/containers/checked_range_unittest.cc(49,17): error: call to 'size' is ambiguous
      static_assert(size(array) == range.size(), "");
                    ^~~~
    ../../buildtools/third_party/libc++/trunk/include\iterator(1875,16): note: candidate function [with _Cont = std::__1::array<int, 5>]
    constexpr auto size(const _Cont& __c)
                   ^
    ../..\base/stl_util.h(90,16): note: candidate function [with Container = std::__1::array<int, 5>]
    constexpr auto size(const Container& c) -> decltype(c.size()) {
                   ^
    ../../base/containers/checked_range_unittest.cc(62,17): error: call to 'data' is ambiguous
      static_assert(data(il) == range.data(), "");
                    ^~~~
    ../../buildtools/third_party/libc++/trunk/include\iterator(1932,22): note: candidate function [with _Ep = int]
    constexpr const _Ep* data(initializer_list<_Ep> __il) noexcept { return __il.begin(); }
                         ^
    ../..\base/stl_util.h(146,20): note: candidate function [with T = int]
    constexpr const T* data(std::initializer_list<T> il) noexcept {
                       ^
    ../../base/containers/checked_range_unittest.cc(63,17): error: call to 'size' is ambiguous
      static_assert(size(il) == range.size(), "");
                    ^~~~
    ../../buildtools/third_party/libc++/trunk/include\iterator(1875,16): note: candidate function [with _Cont = std::initializer_list<int>]
    constexpr auto size(const _Cont& __c)
                   ^
    ../..\base/stl_util.h(90,16): note: candidate function [with Container = std::initializer_list<int>]
    constexpr auto size(const Container& c) -> decltype(c.size()) {
                   ^
    ../../base/containers/checked_range_unittest.cc(164,17): error: call to 'size' is ambiguous
      static_assert(size(array) == range.size(), "");
                    ^~~~
    ../../buildtools/third_party/libc++/trunk/include\iterator(1875,16): note: candidate function [with _Cont = std::__1::array<int, 0>]
    constexpr auto size(const _Cont& __c)
                   ^
    ../..\base/stl_util.h(90,16): note: candidate function [with Container = std::__1::array<int, 0>]
    constexpr auto size(const Container& c) -> decltype(c.size()) {
                   ^
    
    Bug: 752720
    Change-Id: Icac3e6118db2e2fefa288ce23386b75714d1b979
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2094295
    Auto-Submit: Raul Tambre <raul@tambre.ee>
    Commit-Queue: Daniel Cheng <dcheng@chromium.org>
    Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#748098}
    78ac5c8b
checked_range_unittest.cc 9.07 KB