[libcxx-commits] [PATCH] D122092: [libc++] `bitset::operator[] const` should return bool
Mark de Wever via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Mar 20 06:06:30 PDT 2022
Mordante added inline comments.
================
Comment at: libcxx/include/bitset:717
// element access:
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
- const_reference operator[](size_t __p) const {return base::__make_ref(__p);}
- _LIBCPP_INLINE_VISIBILITY reference operator[](size_t __p) {return base::__make_ref(__p);}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bool operator[](size_t __p) const {return base::__make_ref(__p);}
+ _LIBCPP_INLINE_VISIBILITY reference operator[](size_t __p) {return base::__make_ref(__p);}
----------------
Changing the return type is an ABI break. So we can only make this change in the unstable ABI.
================
Comment at: libcxx/test/std/utilities/template.bitset/bitset.members/index_const.pass.cpp:30
}
+ static_assert(std::is_same<decltype(cases[0][0]), bool>::value, "");
}
----------------
FYI you can use `ASSERT_SAME_TYPE`.
================
Comment at: libcxx/test/std/utilities/template.bitset/bitset.members/index_const.pass.cpp:30
}
+ static_assert(std::is_same<decltype(cases[0][0]), bool>::value, "");
}
----------------
Mordante wrote:
> FYI you can use `ASSERT_SAME_TYPE`.
Since the operator returns different types, maybe it's good to add an explicit type test in
`libcxx/test/std/utilities/template.bitset/bitset.members/index.pass.cpp` too.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122092/new/
https://reviews.llvm.org/D122092
More information about the libcxx-commits
mailing list