diff --git a/libcxx/include/locale b/libcxx/include/locale --- a/libcxx/include/locale +++ b/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 >(__iob.getloc()).widen(__num_get_base::__src, __num_get_base::__src + 26, __atoms); diff --git a/libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/char.compile.pass.cpp b/libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/char.compile.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/char.compile.pass.cpp @@ -0,0 +1,62 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// + +// + +#include + +#include "test_macros.h" + +struct Char { + Char(); + Char(char); + Char(unsigned); + explicit Char(int32_t); + operator int32_t() const; +}; +namespace std { +template <> +struct char_traits { + typedef Char char_type; + typedef int int_type; + typedef streamoff off_type; + typedef streampos pos_type; + static char_type* find(const char_type*, size_t, char_type); + static char_type to_char_type(int_type); + static int_type to_int_type(char_type); + static int eq_int_type(int_type, int_type); + static int_type eof(); +}; +template <> +class ctype : public locale::facet { +public: + static locale::id id; + Char toupper(Char) const; + int widen(const char*, const char*, Char*) const; +}; +template <> +class numpunct : public locale::facet { +public: + typedef basic_string string_type; + static locale::id id; + Char decimal_point() const; + Char thousands_sep() const; + string grouping() const; + string_type truename() const; + string_type falsename() const; +}; +template <> +struct basic_string { + Char operator[](int) const; + int copy(Char*, int) const; + unsigned long size() const; + bool empty() const; +}; +} // namespace std +void f() { new std::num_get; }