[libcxx-commits] [PATCH] D100005: [libc++] Use the more precise constructor for char_type in std::num_get::do_get.

Yichen Yan via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 7 01:35:06 PDT 2021


oraluben updated this revision to Diff 335749.
oraluben added a comment.

In D100005#2673424 <https://reviews.llvm.org/D100005#2673424>, @curdeius wrote:

> This will mean we have a UB. The fact that other places kept `__thousands_sep` uninitialized is that it's set by `__stage2_int_prep`/`__stage2_float_prep`.

Thanks. Then `char_type()` would be much better. If there's no default constructor somewhere else is indeed failing.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100005/new/

https://reviews.llvm.org/D100005

Files:
  libcxx/include/locale


Index: libcxx/include/locale
===================================================================
--- libcxx/include/locale
+++ libcxx/include/locale
@@ -1069,7 +1069,7 @@
     int __base = 16;
     // Stage 2
     char_type __atoms[26];
-    char_type __thousands_sep = 0;
+    char_type __thousands_sep = char_type();
     string __grouping;
     use_facet<ctype<_CharT> >(__iob.getloc()).widen(__num_get_base::__src,
                                                     __num_get_base::__src + 26, __atoms);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100005.335749.patch
Type: text/x-patch
Size: 510 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210407/a34453cb/attachment.bin>


More information about the libcxx-commits mailing list