Skip to content

Commit 7cd6097

Browse files
committed
Fix ambiguous call to std::max in vector<bool>
1 parent 7cabcdb commit 7cd6097

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-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
@@ -549,7 +549,7 @@ vector<bool, _Allocator>::__recommend(size_type __new_size) const {
549549
const size_type __cap = capacity();
550550
if (__cap >= __ms / 2)
551551
return __ms;
552-
return std::max(2 * __cap, __align_it(__new_size));
552+
return std::max<size_type>(2 * __cap, __align_it(__new_size));
553553
}
554554

555555
// Default constructs __n objects starting at __end_

libcxx/include/string

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2629,7 +2629,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__
26292629
__throw_length_error();
26302630
pointer __old_p = __get_pointer();
26312631
size_type __cap =
2632-
__old_cap < __ms / 2 - __alignment ? __recommend(std::max(__old_cap + __delta_cap, 2 * __old_cap)) : __ms;
2632+
__old_cap < __ms / 2 - __alignment ? __recommend(std::max<size_type>(__old_cap + __delta_cap, 2 * __old_cap)) : __ms;
26332633
__annotate_delete();
26342634
auto __guard = std::__make_scope_guard(__annotate_new_size(*this));
26352635
auto __allocation = std::__allocate_at_least(__alloc_, __cap + 1);

0 commit comments

Comments
 (0)