[libcxx-commits] [PATCH] D124103: [libc++] Fixes concepts overload resolution.
Mark de Wever via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Apr 20 09:53:10 PDT 2022
Mordante created this revision.
Mordante added a reviewer: royjacobson.
Herald added a project: All.
Mordante requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
D123182 <https://reviews.llvm.org/D123182> fixes a bug in Clang's overload resolution. After it landed it
was discovered `basic_format_arg`'s constructors contains this bug. This
fixes the bug in libc++, unblocking D123182 <https://reviews.llvm.org/D123182>.
The code has been tested in combination with D123182 <https://reviews.llvm.org/D123182>.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D124103
Files:
libcxx/include/__format/format_arg.h
Index: libcxx/include/__format/format_arg.h
===================================================================
--- libcxx/include/__format/format_arg.h
+++ libcxx/include/__format/format_arg.h
@@ -160,17 +160,17 @@
};
__format::__arg_t __type_;
- _LIBCPP_HIDE_FROM_ABI explicit basic_format_arg(bool __v) noexcept
+ _LIBCPP_HIDE_FROM_ABI explicit basic_format_arg(const bool& __v) noexcept
: __boolean(__v), __type_(__format::__arg_t::__boolean) {}
template <class _Tp>
- _LIBCPP_HIDE_FROM_ABI explicit basic_format_arg(_Tp __v) noexcept
+ _LIBCPP_HIDE_FROM_ABI explicit basic_format_arg(const _Tp& __v) noexcept
requires(same_as<_Tp, char_type> ||
(same_as<_Tp, char> && same_as<char_type, wchar_t>))
: __char_type(__v), __type_(__format::__arg_t::__char_type) {}
template <__libcpp_signed_integer _Tp>
- _LIBCPP_HIDE_FROM_ABI explicit basic_format_arg(_Tp __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI explicit basic_format_arg(const _Tp& __v) noexcept {
if constexpr (sizeof(_Tp) <= sizeof(int)) {
__int = static_cast<int>(__v);
__type_ = __format::__arg_t::__int;
@@ -189,7 +189,7 @@
}
template <__libcpp_unsigned_integer _Tp>
- _LIBCPP_HIDE_FROM_ABI explicit basic_format_arg(_Tp __v) noexcept {
+ _LIBCPP_HIDE_FROM_ABI explicit basic_format_arg(const _Tp& __v) noexcept {
if constexpr (sizeof(_Tp) <= sizeof(unsigned)) {
__unsigned = static_cast<unsigned>(__v);
__type_ = __format::__arg_t::__unsigned;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124103.423939.patch
Type: text/x-patch
Size: 1513 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220420/68694115/attachment-0001.bin>
More information about the libcxx-commits
mailing list