diff --git a/stl/inc/__msvc_chrono.hpp b/stl/inc/__msvc_chrono.hpp index 750d5762d..1f787a25b 100644 --- a/stl/inc/__msvc_chrono.hpp +++ b/stl/inc/__msvc_chrono.hpp @@ -502,8 +502,12 @@ namespace chrono { template ::is_signed, int> = 0> _NODISCARD constexpr duration<_Rep, _Period> abs(const duration<_Rep, _Period> _Dur) noexcept( is_arithmetic_v<_Rep>) /* strengthened */ { - // create a duration with count() the absolute value of _Dur.count() - return _Dur < duration<_Rep, _Period>::zero() ? duration<_Rep, _Period>::zero() - _Dur : _Dur; + // create a duration whose count() is the absolute value of _Dur.count() + if (_Dur < duration<_Rep, _Period>::zero()) { + return duration<_Rep, _Period>::zero() - _Dur; + } else { + return _Dur; + } } using nanoseconds = duration; diff --git a/tests/libcxx/expected_results.txt b/tests/libcxx/expected_results.txt index 324b977c7..1db9dd69e 100644 --- a/tests/libcxx/expected_results.txt +++ b/tests/libcxx/expected_results.txt @@ -794,9 +794,6 @@ std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt. std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_encoding.pass.cpp FAIL std/localization/locale.categories/category.ctype/locale.codecvt/locale.codecvt.members/char32_t_max_length.pass.cpp FAIL -# Likely STL bug in : "result type of conditional expression is ambiguous" -std/utilities/time/time.duration/time.duration.alg/abs.pass.cpp FAIL - # Likely STL bug in : we check argument ids at compiletime in next_arg_id std/utilities/format/format.formatter/format.parse.ctx/next_arg_id.pass.cpp FAIL diff --git a/tests/libcxx/skipped_tests.txt b/tests/libcxx/skipped_tests.txt index 4ad3441c3..28e449cea 100644 --- a/tests/libcxx/skipped_tests.txt +++ b/tests/libcxx/skipped_tests.txt @@ -790,9 +790,6 @@ localization\locale.categories\category.ctype\locale.codecvt\locale.codecvt.memb localization\locale.categories\category.ctype\locale.codecvt\locale.codecvt.members\char32_t_encoding.pass.cpp localization\locale.categories\category.ctype\locale.codecvt\locale.codecvt.members\char32_t_max_length.pass.cpp -# Likely STL bug in : "result type of conditional expression is ambiguous" -utilities\time\time.duration\time.duration.alg\abs.pass.cpp - # Likely STL bug in : we check argument ids at compiletime in next_arg_id utilities\format\format.formatter\format.parse.ctx\next_arg_id.pass.cpp