diff --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp --- a/libcxx/src/locale.cpp +++ b/libcxx/src/locale.cpp @@ -4597,7 +4597,10 @@ __num_put_base::__format_int(char* __fmtp, const char* __len, bool __signd, ios_base::fmtflags __flags) { - if (__flags & ios_base::showpos) + if ((__flags & ios_base::showpos) && + (__flags & ios_base::basefield) != ios_base::oct && + (__flags & ios_base::basefield) != ios_base::hex && + __signd) *__fmtp++ = '+'; if (__flags & ios_base::showbase) *__fmtp++ = '#';