xref: /openbsd-src/gnu/lib/libstdc++/libstdc++/testsuite/22_locale/messages.cc (revision 03a78d155d6fff5698289342b62759a75b20d130)
1*03a78d15Sespie // 2001-07-17  Benjamin Kosnik  <bkoz@redhat.com>
2*03a78d15Sespie 
3*03a78d15Sespie // Copyright (C) 2001 Free Software Foundation
4*03a78d15Sespie //
5*03a78d15Sespie // This file is part of the GNU ISO C++ Library.  This library is free
6*03a78d15Sespie // software; you can redistribute it and/or modify it under the
7*03a78d15Sespie // terms of the GNU General Public License as published by the
8*03a78d15Sespie // Free Software Foundation; either version 2, or (at your option)
9*03a78d15Sespie // any later version.
10*03a78d15Sespie 
11*03a78d15Sespie // This library is distributed in the hope that it will be useful,
12*03a78d15Sespie // but WITHOUT ANY WARRANTY; without even the implied warranty of
13*03a78d15Sespie // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*03a78d15Sespie // GNU General Public License for more details.
15*03a78d15Sespie 
16*03a78d15Sespie // You should have received a copy of the GNU General Public License along
17*03a78d15Sespie // with this library; see the file COPYING.  If not, write to the Free
18*03a78d15Sespie // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19*03a78d15Sespie // USA.
20*03a78d15Sespie 
21*03a78d15Sespie // 22.2.7 The message retrieval category
22*03a78d15Sespie 
23*03a78d15Sespie // { dg-do compile }
24*03a78d15Sespie 
25*03a78d15Sespie #include <locale>
26*03a78d15Sespie 
test01()27*03a78d15Sespie void test01()
28*03a78d15Sespie {
29*03a78d15Sespie   // Check for required base class.
30*03a78d15Sespie   typedef std::messages<char> test_type;
31*03a78d15Sespie   typedef std::locale::facet base_type1;
32*03a78d15Sespie   typedef std::messages_base base_type2;
33*03a78d15Sespie   const test_type& obj = std::use_facet<test_type>(std::locale());
34*03a78d15Sespie   const base_type1* base1 = &obj;
35*03a78d15Sespie   const base_type2* base2 = &obj;
36*03a78d15Sespie 
37*03a78d15Sespie   // Check for required typedefs
38*03a78d15Sespie   typedef test_type::char_type char_type;
39*03a78d15Sespie   typedef test_type::string_type string_type;
40*03a78d15Sespie }
41*03a78d15Sespie 
42*03a78d15Sespie // Should be able to instantiate this for other types besides char, wchar_t
43*03a78d15Sespie class gnu_messages: public std::messages<unsigned char>
44*03a78d15Sespie { };
45*03a78d15Sespie 
test02()46*03a78d15Sespie void test02()
47*03a78d15Sespie {
48*03a78d15Sespie   gnu_messages facet01;
49*03a78d15Sespie }
50*03a78d15Sespie 
main()51*03a78d15Sespie int main()
52*03a78d15Sespie {
53*03a78d15Sespie   test01();
54*03a78d15Sespie   test02();
55*03a78d15Sespie   return 0;
56*03a78d15Sespie }
57