1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // <locale>
11 
12 // class moneypunct<charT, International>
13 
14 // int frac_digits() const;
15 
16 // The C++ and C standards are silent.
17 //   POSIX standard is being followed (as a guideline).
18 
19 #include <locale>
20 #include <limits>
21 #include <cassert>
22 
23 typedef std::moneypunct<char> F;
24 
25 class Fnf
26     : public std::moneypunct<char, false>
27 {
28 public:
Fnf(std::size_t refs=0)29     explicit Fnf(std::size_t refs = 0)
30         : std::moneypunct<char, false>(refs) {}
31 };
32 
33 class Fnt
34     : public std::moneypunct<char, true>
35 {
36 public:
Fnt(std::size_t refs=0)37     explicit Fnt(std::size_t refs = 0)
38         : std::moneypunct<char, true>(refs) {}
39 };
40 
41 class Fwf
42     : public std::moneypunct<wchar_t, false>
43 {
44 public:
Fwf(std::size_t refs=0)45     explicit Fwf(std::size_t refs = 0)
46         : std::moneypunct<wchar_t, false>(refs) {}
47 };
48 
49 class Fwt
50     : public std::moneypunct<wchar_t, true>
51 {
52 public:
Fwt(std::size_t refs=0)53     explicit Fwt(std::size_t refs = 0)
54         : std::moneypunct<wchar_t, true>(refs) {}
55 };
56 
main()57 int main()
58 {
59     {
60         Fnf f(1);
61         assert(f.frac_digits() == 0);
62     }
63     {
64         Fnt f(1);
65         assert(f.frac_digits() == 0);
66     }
67     {
68         Fwf f(1);
69         assert(f.frac_digits() == 0);
70     }
71     {
72         Fwt f(1);
73         assert(f.frac_digits() == 0);
74     }
75 }
76