Skip to content

Commit 51b21fd

Browse files
committed
Fix ambiguous call to std::max in vector<bool>
1 parent e3e26dc commit 51b21fd

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

libcxx/include/__cxx03/string

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2483,7 +2483,9 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__
24832483
__throw_length_error();
24842484
pointer __old_p = __get_pointer();
24852485
size_type __cap =
2486-
__old_cap < __ms / 2 - __alignment ? __recommend(std::max(__old_cap + __delta_cap, 2 * __old_cap)) : __ms - 1;
2486+
__old_cap < __ms / 2 - __alignment
2487+
? __recommend(std::max<size_type>(__old_cap + __delta_cap, 2 * __old_cap))
2488+
: __ms - 1;
24872489
__annotate_delete();
24882490
auto __allocation = std::__allocate_at_least(__alloc(), __cap + 1);
24892491
pointer __p = __allocation.ptr;
@@ -2526,7 +2528,9 @@ _LIBCPP_DEPRECATED_("use __grow_by_without_replace") basic_string<_CharT, _Trait
25262528
__throw_length_error();
25272529
pointer __old_p = __get_pointer();
25282530
size_type __cap =
2529-
__old_cap < __ms / 2 - __alignment ? __recommend(std::max(__old_cap + __delta_cap, 2 * __old_cap)) : __ms - 1;
2531+
__old_cap < __ms / 2 - __alignment
2532+
? __recommend(std::max<size_type>(__old_cap + __delta_cap, 2 * __old_cap))
2533+
: __ms - 1;
25302534
__annotate_delete();
25312535
auto __allocation = std::__allocate_at_least(__alloc(), __cap + 1);
25322536
pointer __p = __allocation.ptr;

libcxx/include/__cxx03/vector

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2328,7 +2328,7 @@ vector<bool, _Allocator>::__recommend(size_type __new_size) const {
23282328
const size_type __cap = capacity();
23292329
if (__cap >= __ms / 2)
23302330
return __ms;
2331-
return std::max(2 * __cap, __align_it(__new_size));
2331+
return std::max<size_type>(2 * __cap, __align_it(__new_size));
23322332
}
23332333

23342334
// Default constructs __n objects starting at __end_

libcxx/include/__vector/vector_bool.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ vector<bool, _Allocator>::__recommend(size_type __new_size) const {
545545
const size_type __cap = capacity();
546546
if (__cap >= __ms / 2)
547547
return __ms;
548-
return std::max(2 * __cap, __align_it(__new_size));
548+
return std::max<size_type>(2 * __cap, __align_it(__new_size));
549549
}
550550

551551
// Default constructs __n objects starting at __end_

libcxx/include/string

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2514,7 +2514,9 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__
25142514
__throw_length_error();
25152515
pointer __old_p = __get_pointer();
25162516
size_type __cap =
2517-
__old_cap < __ms / 2 - __alignment ? __recommend(std::max(__old_cap + __delta_cap, 2 * __old_cap)) : __ms - 1;
2517+
__old_cap < __ms / 2 - __alignment
2518+
? __recommend(std::max<size_type>(__old_cap + __delta_cap, 2 * __old_cap))
2519+
: __ms - 1;
25182520
__annotate_delete();
25192521
auto __guard = std::__make_scope_guard(__annotate_new_size(*this));
25202522
auto __allocation = std::__allocate_at_least(__alloc_, __cap + 1);

0 commit comments

Comments
 (0)