1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // REQUIRES: locale.en_US.UTF-8
16 // locale imbue(const locale& loc);
23 #include "platform_support.h" // locale name macros
35 bool f1_called = false;
36 bool f2_called = false;
37 bool f3_called = false;
39 void f1(std::ios_base::event ev, std::ios_base& stream, int index)
41 if (ev == std::ios_base::imbue_event)
46 assert(stream.getloc().name() == LOCALE_en_US_UTF_8);
52 void f2(std::ios_base::event ev, std::ios_base& stream, int index)
54 if (ev == std::ios_base::imbue_event)
59 assert(stream.getloc().name() == LOCALE_en_US_UTF_8);
65 void f3(std::ios_base::event ev, std::ios_base& stream, int index)
67 if (ev == std::ios_base::imbue_event)
72 assert(stream.getloc().name() == LOCALE_en_US_UTF_8);
82 b.register_callback(f1, 4);
83 b.register_callback(f2, 5);
84 b.register_callback(f3, 6);
85 std::locale l = b.imbue(std::locale(LOCALE_en_US_UTF_8));
86 assert(l.name() == std::string("C"));
87 assert(b.getloc().name() == std::string(LOCALE_en_US_UTF_8));