1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // REQUIRES: locale.en_US.UTF-8
10 
11 // <streambuf>
12 
13 // template <class charT, class traits = char_traits<charT> >
14 // class basic_streambuf;
15 
16 // basic_streambuf();
17 
18 #include <streambuf>
19 #include <cassert>
20 
21 #include "platform_support.h" // locale name macros
22 
23 template <class CharT>
24 struct test
25     : public std::basic_streambuf<CharT>
26 {
27     test()
28     {
29         assert(this->eback() == 0);
30         assert(this->gptr() == 0);
31         assert(this->egptr() == 0);
32         assert(this->pbase() == 0);
33         assert(this->pptr() == 0);
34         assert(this->epptr() == 0);
35     }
36 };
37 
38 int main(int, char**)
39 {
40     {
41         test<char> t;
42         assert(t.getloc().name() == "C");
43     }
44     {
45         test<wchar_t> t;
46         assert(t.getloc().name() == "C");
47     }
48     std::locale::global(std::locale(LOCALE_en_US_UTF_8));
49     {
50         test<char> t;
51         assert(t.getloc().name() == LOCALE_en_US_UTF_8);
52     }
53     {
54         test<wchar_t> t;
55         assert(t.getloc().name() == LOCALE_en_US_UTF_8);
56     }
57 
58   return 0;
59 }
60