summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/22_locale/time_put
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /libstdc++-v3/testsuite/22_locale/time_put
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'libstdc++-v3/testsuite/22_locale/time_put')
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/1.cc80
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/10.cc62
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/12439_1.cc65
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/12439_3.cc63
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/17038.cc64
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/2.cc79
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/3.cc79
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/4.cc79
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/5.cc65
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/6.cc67
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/7.cc67
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/8.cc66
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/9.cc64
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/9780-1.cc133
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/wrapped_env.cc85
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/char/wrapped_locale.cc85
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/1.cc83
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/10.cc64
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_1.cc63
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_2.cc59
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_3.cc61
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/17038.cc64
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/2.cc80
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/3.cc80
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/4.cc81
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/5.cc68
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/6.cc68
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/7.cc68
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/8.cc68
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/9.cc66
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/wrapped_env.cc85
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/wrapped_locale.cc86
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/requirements/base_classes.cc32
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/requirements/explicit_instantiation.cc26
-rw-r--r--libstdc++-v3/testsuite/22_locale/time_put/requirements/typedefs.cc31
35 files changed, 2436 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/1.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/1.cc
new file mode 100644
index 000000000..32388cc6f
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/1.cc
@@ -0,0 +1,80 @@
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010
+// Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<char> iterator_type;
+
+ bool test __attribute__((unused)) = true;
+
+ // create "C" time objects
+ const tm time1 = __gnu_test::test_tm(0, 0, 12, 4, 3, 71, 0, 93, 0);
+
+ // basic construction
+ locale loc_c = locale::classic();
+
+ // create an ostream-derived object, cache the time_put facet
+ const string empty;
+ ostringstream oss;
+ oss.imbue(loc_c);
+ const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc());
+
+ // 1
+ // iter_type
+ // put(iter_type s, ios_base& str, char_type fill, const tm* t,
+ // char format, char modifier = 0) const;
+ oss.str(empty);
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
+ string result1 = oss.str();
+ VERIFY( result1 == "Sun" );
+
+ oss.str(empty);
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
+ string result21 = oss.str(); // "04/04/71"
+ VERIFY( result21 == "04/04/71" );
+
+ oss.str(empty);
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
+ string result22 = oss.str(); // "12:00:00"
+ VERIFY( result22 == "12:00:00" );
+
+ oss.str(empty);
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
+ string result31 = oss.str(); // "04/04/71"
+ VERIFY( result31 == "04/04/71" );
+
+ oss.str(empty);
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
+ string result32 = oss.str(); // "12:00:00"
+ VERIFY( result32 == "12:00:00" );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/10.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/10.cc
new file mode 100644
index 000000000..65f6e5f27
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/10.cc
@@ -0,0 +1,62 @@
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009
+// Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test10()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ // Check time_put works with other iterators besides streambuf
+ // output iterators. (As long as output_iterator requirements are met.)
+ typedef string::iterator iter_type;
+ typedef char_traits<char> traits;
+ typedef time_put<char, iter_type> time_put_type;
+ const ios_base::iostate goodbit = ios_base::goodbit;
+
+ ios_base::iostate err = goodbit;
+ const locale loc_c = locale::classic();
+ const string x(50, 'x'); // have to have allocated string!
+ string res;
+ const tm time_sanity = __gnu_test::test_tm(0, 0, 12, 26, 5, 97, 2, 0, 0);
+
+ ostringstream oss;
+ oss.imbue(locale(loc_c, new time_put_type));
+ const time_put_type& tp = use_facet<time_put_type>(oss.getloc());
+
+ // 02 char format
+ res = x;
+ iter_type ret2 = tp.put(res.begin(), oss, ' ', &time_sanity, 'A');
+ string sanity2(res.begin(), ret2);
+ VERIFY( err == goodbit );
+ VERIFY( res == "Tuesdayxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" );
+ VERIFY( sanity2 == "Tuesday" );
+}
+
+int main()
+{
+ test10();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/12439_1.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/12439_1.cc
new file mode 100644
index 000000000..3c6ad92e4
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/12439_1.cc
@@ -0,0 +1,65 @@
+// Copyright (C) 2003, 2009, 2010 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.3.1 time_put members
+
+// { dg-require-time "" }
+
+#include <locale>
+#include <sstream>
+#include <ctime>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+class TP : public std::time_put<char>
+{
+public:
+ mutable std::string fill_chars;
+
+protected:
+ iter_type do_put(iter_type s, std::ios_base&, char_type fill,
+ const std::tm*, char, char) const
+ {
+ fill_chars.push_back(fill);
+ return s;
+ }
+};
+
+// libstdc++/12439
+// time_put::put doesn't pass fill character to do_put
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ ostringstream stream;
+ time_t tt = time(0);
+
+ const char* fmt = "%c";
+
+ TP tp;
+ tp.put(TP::iter_type(stream), stream, 'W', localtime(&tt),
+ fmt, fmt + strlen(fmt));
+ VERIFY( !tp.fill_chars.empty() );
+ VERIFY( tp.fill_chars[tp.fill_chars.length() - 1] == 'W' );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/12439_3.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/12439_3.cc
new file mode 100644
index 000000000..3d19d36c2
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/12439_3.cc
@@ -0,0 +1,63 @@
+// Copyright (C) 2003, 2009, 2010 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.3.1 time_put members
+
+// { dg-require-time "" }
+
+#include <locale>
+#include <sstream>
+#include <ctime>
+#include <testsuite_hooks.h>
+
+class TP : public std::time_put<char>
+{
+public:
+ mutable std::string format_chars;
+
+protected:
+ iter_type do_put(iter_type s, std::ios_base&, char_type,
+ const std::tm*, char format, char) const
+ {
+ format_chars.push_back(format);
+ return s;
+ }
+};
+
+// libstdc++/12439
+// time_put::put reads past end of format string
+void test03()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ ostringstream stream;
+ time_t tt = time(0);
+
+ const char* fmt = "%c";
+
+ TP tp;
+ tp.put(TP::iter_type(stream), stream, stream.fill(), localtime(&tt),
+ fmt, fmt + 1);
+ VERIFY( tp.format_chars.empty() );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/17038.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/17038.cc
new file mode 100644
index 000000000..a2043f10b
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/17038.cc
@@ -0,0 +1,64 @@
+// { dg-require-namedlocale "ta_IN" }
+
+// 2004-08-25 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2004, 2005, 2006, 2009, 2010 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/17038
+void test01()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<char> iterator_type;
+
+ bool test __attribute__((unused)) = true;
+
+ // create "C" time objects
+ const tm time1 = __gnu_test::test_tm(0, 0, 12, 4, 3, 71, 0, 93, 0);
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_in = locale("ta_IN");
+ VERIFY( loc_in != loc_c );
+
+ // create an ostream-derived object, cache the time_put facet
+ ostringstream oss;
+ oss.imbue(loc_in);
+ const time_put<char>& tim_put =
+ use_facet<time_put<char> >(oss.getloc());
+
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'c');
+ string result1 = oss.str();
+
+ char time_buffer[128];
+ setlocale(LC_ALL, "ta_IN");
+ VERIFY( strftime(time_buffer, 128, "%c", &time1) );
+
+ VERIFY( result1 == time_buffer );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/2.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/2.cc
new file mode 100644
index 000000000..fa5053fc1
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/2.cc
@@ -0,0 +1,79 @@
+// { dg-require-namedlocale "de_DE" }
+
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010
+// Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test02()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<char> iterator_type;
+
+ bool test __attribute__((unused)) = true;
+
+ // create "C" time object
+ const tm time1 = __gnu_test::test_tm(0, 0, 12, 4, 3, 71, 0, 93, 0);
+
+ // basic construction and sanity check
+ locale loc_c = locale::classic();
+ locale loc_de = locale("de_DE");
+ VERIFY( loc_de != loc_c );
+
+ // create an ostream-derived object, cache the time_put facet
+ const string empty;
+ ostringstream oss;
+ oss.imbue(loc_de);
+ const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc());
+
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
+ string result2 = oss.str();
+ VERIFY( result2 == "Son" || result2 == "So" );
+
+ oss.str(empty); // "%d.%m.%Y"
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
+ string result23 = oss.str(); // "04.04.1971"
+ VERIFY( result23 == "04.04.1971" );
+
+ oss.str(empty); // "%T"
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
+ string result24 = oss.str(); // "12:00:00"
+ VERIFY( result24 == "12:00:00" );
+
+ oss.str(empty);
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
+ string result33 = oss.str(); // "04.04.1971"
+ VERIFY( result33 == "04.04.1971" );
+
+ oss.str(empty);
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
+ string result34 = oss.str(); // "12:00:00"
+ VERIFY( result34 == "12:00:00" );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/3.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/3.cc
new file mode 100644
index 000000000..d4f04c29a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/3.cc
@@ -0,0 +1,79 @@
+// { dg-require-namedlocale "en_HK" }
+
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010
+// Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test03()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<char> iterator_type;
+
+ bool test __attribute__((unused)) = true;
+
+ // create "C" time objects
+ const tm time1 = __gnu_test::test_tm(0, 0, 12, 4, 3, 71, 0, 93, 0);
+
+ // basic construction and sanity check.
+ locale loc_c = locale::classic();
+ locale loc_hk = locale("en_HK");
+ VERIFY( loc_hk != loc_c );
+
+ // create an ostream-derived object, cache the time_put facet
+ const string empty;
+ ostringstream oss;
+ oss.imbue(loc_hk);
+ const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc());
+
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
+ string result3 = oss.str();
+ VERIFY( result3 == "Sun" );
+
+ oss.str(empty); // "%A, %B %d, %Y"
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
+ string result25 = oss.str(); // "Sunday, April 04, 1971"
+ VERIFY( result25 == "Sunday, April 04, 1971" );
+
+ oss.str(empty); // "%I:%M:%S %Z"
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
+ string result26 = oss.str(); // "12:00:00 CET" or whatever timezone
+ VERIFY( result26.find("12:00:00") != string::npos );
+
+ oss.str(empty);
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
+ string result35 = oss.str(); // "Sunday, April 04, 1971"
+ VERIFY( result35 == "Sunday, April 04, 1971" );
+
+ oss.str(empty);
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
+ string result36 = oss.str(); // "12:00:00 CET"
+ VERIFY( result36.find("12:00:00") != string::npos );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/4.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/4.cc
new file mode 100644
index 000000000..a433cda86
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/4.cc
@@ -0,0 +1,79 @@
+// { dg-require-namedlocale "es_ES" }
+
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+// 2009, 2010
+// Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test04()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<char> iterator_type;
+
+ bool test __attribute__((unused)) = true;
+
+ // create "C" time objects
+ const tm time1 = __gnu_test::test_tm(0, 0, 12, 4, 3, 71, 0, 93, 0);
+
+ // basic construction and sanity check
+ locale loc_c = locale::classic();
+ locale loc_es = locale("es_ES");
+ VERIFY( loc_es != loc_c );
+
+ // create an ostream-derived object, cache the time_put facet
+ const string empty;
+ ostringstream oss;
+ oss.imbue(loc_es);
+ const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc());
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'a');
+ string result4 = oss.str();
+ VERIFY( result4 == "dom" );
+
+ oss.str(empty); // "%d/%m/%y"
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x');
+ string result27 = oss.str(); // "04/04/71"
+ VERIFY( result27 == "04/04/71" );
+
+ oss.str(empty); // "%T"
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X');
+ string result28 = oss.str(); // "12:00:00"
+ VERIFY( result28 == "12:00:00" );
+
+ oss.str(empty);
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'x', 'E');
+ string result37 = oss.str(); // "04/04/71"
+ VERIFY( result37 == "04/04/71" );
+
+ oss.str(empty);
+ tim_put.put(oss.rdbuf(), oss, '*', &time1, 'X', 'E');
+ string result38 = oss.str(); // "12:00:00"
+ VERIFY( result38 == "12:00:00" );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/5.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/5.cc
new file mode 100644
index 000000000..96ce947c2
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/5.cc
@@ -0,0 +1,65 @@
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test05()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<char> iterator_type;
+ typedef char_traits<char> traits;
+
+ bool test __attribute__((unused)) = true;
+
+ // create "C" time objects
+ const tm time1 = __gnu_test::test_tm(0, 0, 12, 4, 3, 71, 0, 93, 0);
+ const char* date = "%A, the second of %B";
+ const char* date_ex = "%Ex";
+
+ // basic construction
+ locale loc_c = locale::classic();
+
+ // create an ostream-derived object, cache the time_put facet
+ const string empty;
+ ostringstream oss;
+ oss.imbue(loc_c);
+ const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc());
+
+ // 2
+ oss.str(empty);
+ tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date, date + traits::length(date));
+ string result5 = oss.str();
+ VERIFY( result5 == "Sunday, the second of April");
+ tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date_ex, date_ex + traits::length(date_ex));
+ string result6 = oss.str();
+ VERIFY( result6 != result5 );
+}
+
+int main()
+{
+ test05();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/6.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/6.cc
new file mode 100644
index 000000000..1dc53e327
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/6.cc
@@ -0,0 +1,67 @@
+// { dg-require-namedlocale "de_DE" }
+
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test06()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<char> iterator_type;
+ typedef char_traits<char> traits;
+
+ bool test __attribute__((unused)) = true;
+
+ // create "C" time objects
+ const tm time1 = __gnu_test::test_tm(0, 0, 12, 4, 3, 71, 0, 93, 0);
+ const char* date = "%A, the second of %B";
+ const char* date_ex = "%Ex";
+
+ // basic construction and sanity check
+ locale loc_c = locale::classic();
+ locale loc_de = locale("de_DE");
+ VERIFY( loc_de != loc_c );
+
+ // create an ostream-derived object, cache the time_put facet
+ const string empty;
+ ostringstream oss;
+ oss.imbue(loc_de);
+ const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc());
+
+ tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date, date + traits::length(date));
+ string result7 = oss.str();
+ VERIFY( result7 == "Sonntag, the second of April");
+ tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date_ex, date_ex + traits::length(date_ex));
+ string result8 = oss.str();
+ VERIFY( result8 != result7 );
+}
+
+int main()
+{
+ test06();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/7.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/7.cc
new file mode 100644
index 000000000..595fadf78
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/7.cc
@@ -0,0 +1,67 @@
+// { dg-require-namedlocale "en_HK" }
+
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test07()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<char> iterator_type;
+ typedef char_traits<char> traits;
+
+ bool test __attribute__((unused)) = true;
+
+ // create "C" time objects
+ const tm time1 = __gnu_test::test_tm(0, 0, 12, 4, 3, 71, 0, 93, 0);
+ const char* date = "%A, the second of %B";
+ const char* date_ex = "%Ex";
+
+ // basic construction and sanity check
+ locale loc_c = locale::classic();
+ locale loc_hk = locale("en_HK");
+ VERIFY( loc_hk != loc_c );
+
+ // create an ostream-derived object, cache the time_put facet
+ const string empty;
+ ostringstream oss;
+ oss.imbue(loc_hk);
+ const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc());
+
+ tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date, date + traits::length(date));
+ string result9 = oss.str();
+ VERIFY( result9 == "Sunday, the second of April");
+ tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date_ex, date_ex + traits::length(date_ex));
+ string result10 = oss.str();
+ VERIFY( result10 != result9 );
+}
+
+int main()
+{
+ test07();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/8.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/8.cc
new file mode 100644
index 000000000..3274e3532
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/8.cc
@@ -0,0 +1,66 @@
+// { dg-require-namedlocale "fr_FR@euro" }
+
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test08()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<char> iterator_type;
+ typedef char_traits<char> traits;
+
+ bool test __attribute__((unused)) = true;
+
+ // create "C" time objects
+ const tm time1 = __gnu_test::test_tm(0, 0, 12, 4, 3, 71, 0, 93, 0);
+ const char* date = "%A, the second of %B";
+ const char* date_ex = "%Ex";
+
+ // basic construction and sanity check
+ locale loc_c = locale::classic();
+ locale loc_fr = locale("fr_FR@euro");
+ VERIFY( loc_fr != loc_c );
+
+ // create an ostream-derived object, cache the time_put facet
+ const string empty;
+ ostringstream oss;
+ oss.imbue(loc_fr);
+ const time_put<char>& tim_put = use_facet<time_put<char> >(oss.getloc());
+ tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date, date + traits::length(date));
+ string result11 = oss.str();
+ VERIFY( result11 == "dimanche, the second of avril");
+ tim_put.put(oss.rdbuf(), oss, '*', &time1,
+ date_ex, date_ex + traits::length(date_ex));
+ string result12 = oss.str();
+ VERIFY( result12 != result11 );
+}
+
+int main()
+{
+ test08();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/9.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/9.cc
new file mode 100644
index 000000000..0ef9bbc99
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/9.cc
@@ -0,0 +1,64 @@
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009
+// Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test09()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ // Check time_put works with other iterators besides streambuf
+ // output iterators. (As long as output_iterator requirements are met.)
+ typedef string::iterator iter_type;
+ typedef char_traits<char> traits;
+ typedef time_put<char, iter_type> time_put_type;
+ const ios_base::iostate goodbit = ios_base::goodbit;
+
+ ios_base::iostate err = goodbit;
+ const locale loc_c = locale::classic();
+ const string x(50, 'x'); // have to have allocated string!
+ string res;
+ const tm time_sanity = __gnu_test::test_tm(0, 0, 12, 26, 5, 97, 2, 0, 0);
+ const char* date = "%X, %A, the second of %B, %Y";
+
+ ostringstream oss;
+ oss.imbue(locale(loc_c, new time_put_type));
+ const time_put_type& tp = use_facet<time_put_type>(oss.getloc());
+
+ // 01 date format
+ res = x;
+ iter_type ret1 = tp.put(res.begin(), oss, ' ', &time_sanity,
+ date, date + traits::length(date));
+ string sanity1(res.begin(), ret1);
+ VERIFY( err == goodbit );
+ VERIFY( res == "12:00:00, Tuesday, the second of June, 1997xxxxxxx" );
+ VERIFY( sanity1 == "12:00:00, Tuesday, the second of June, 1997" );
+}
+
+int main()
+{
+ test09();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/9780-1.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/9780-1.cc
new file mode 100644
index 000000000..95c4b6844
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/9780-1.cc
@@ -0,0 +1,133 @@
+// { dg-require-namedlocale "de_DE" }
+// { dg-require-namedlocale "es_ES" }
+
+// Copyright (C) 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <sstream>
+#include <locale>
+#include <testsuite_hooks.h>
+
+int main()
+{
+ using namespace std;
+
+ bool test __attribute__((unused)) = true;
+ locale l1 = locale("de_DE");
+ locale l2 = locale("es_ES");
+
+ const time_put<char> &tp = use_facet<time_put<char> >(l1);
+ ostringstream oss;
+ oss.imbue(l2);
+
+ tm t = tm();
+ tp.put(oss.rdbuf(), oss, ' ', &t, 'A');
+ string res = oss.str();
+
+ VERIFY( res == "domingo" );
+
+ return 0;
+}
+
+// Two interpretations of the standard.
+
+// 1 : time_get, time_put each have their own data internally
+// use internal data for time and date specifics
+// use getloc for ctype info
+
+// 2 : time_get, time_put use the ios_base& argument and getloc to
+// retrieve the necessary data.
+// use getloc for ctype, time and date specifics
+
+// It is my opinion that the language in the standard is sufficiently
+// vague to permit both interpretations. In particular, the interface
+// for time_get and time_put is based on strftime, which as
+// POSIX notes is dependent on LC_TIME. The C++ standard, however,
+// does not specify the equivalent mappings of LC_TIME to time_get and
+// time_put.
+
+/*
+The problems with the first approach, as above, are numerous.
+
+1) The locale usage and design for formatters and parsers becomes
+ fragmented. On one side, num_put and money_put, and on the other,
+ time_put. This inconsistency is not useful.
+
+2) The data structures for time and date formatting are the largest in
+ the locale library. Making time_put and time_get keep separate
+ copies is inefficient. (Note that time_put and time_get are in the
+ same locale::category).
+*/
+
+
+/*
+22.2.5 - The time category [lib.category.time]
+
+-1- Templates time_get<charT,InputIterator> and
+ time_put<charT,OutputIterator> provide date and time formatting and
+ parsing. All specifications of member functions for time_put and
+ time_get in the subclauses of lib.category.time only apply to the
+ instantiations required in Tables 51 and 52
+ (lib.locale.category). Their members use their ios_base&,
+ ios_base::iostate&, and fill arguments as described in
+ (lib.locale.categories), and the ctype<> facet, to determine
+ formatting details.
+*/
+
+/*
+22.2 - Standard locale categories [lib.locale.categories]
+
+-1- Each of the standard categories includes a family of facets. Some
+ of these implement formatting or parsing of a datum, for use by
+ standard or users' iostream operators << and >>, as members put() and
+ get(), respectively. Each such member function takes an ios_base&
+ argument whose members flags(), precision(), and width(), specify the
+ format of the corresponding datum. (lib.ios.base). Those functions
+ which need to use other facets call its member getloc() to retrieve
+ the locale imbued there. Formatting facets use the character argument
+ fill to fill out the specified width where necessary.
+*/
+
+/*
+With GCC/libstdc++, the output of the program with the arguments
+of de_DE es_ES is:
+ domingo
+ lunes
+ martes
+ miércoles
+ jueves
+ viernes
+ sábado
+
+With Intel C++, it is: (this is clearly wrong)
+ Sunday
+ Monday
+ Tuesday
+ Wednesday
+ Thursday
+ Friday
+ Saturday
+
+And with RogueWave C++
+ Sonntag
+ Montag
+ Dienstag
+ Mittwoch
+ Donnerstag
+ Freitag
+ Samstag
+*/
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/wrapped_env.cc
new file mode 100644
index 000000000..495dcda9f
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/wrapped_env.cc
@@ -0,0 +1,85 @@
+// { dg-require-namedlocale "de_DE" }
+// { dg-require-namedlocale "en_HK" }
+// { dg-require-namedlocale "es_ES" }
+// { dg-require-namedlocale "fr_FR@euro" }
+
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+#define main discard_main_4
+#include "4.cc"
+#undef main
+
+#define main discard_main_5
+#include "5.cc"
+#undef main
+
+#define main discard_main_6
+#include "6.cc"
+#undef main
+
+#define main discard_main_7
+#include "7.cc"
+#undef main
+
+#define main discard_main_8
+#include "8.cc"
+#undef main
+
+#define main discard_main_9
+#include "9.cc"
+#undef main
+
+#define main discard_main_10
+#include "10.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ two.push_back(&test04);
+ two.push_back(&test05);
+ two.push_back(&test06);
+ two.push_back(&test07);
+ two.push_back(&test08);
+ two.push_back(&test09);
+ two.push_back(&test10);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/wrapped_locale.cc
new file mode 100644
index 000000000..4128ef405
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/wrapped_locale.cc
@@ -0,0 +1,85 @@
+// { dg-require-namedlocale "de_DE" }
+// { dg-require-namedlocale "en_HK" }
+// { dg-require-namedlocale "es_ES" }
+// { dg-require-namedlocale "fr_FR@euro" }
+
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+#define main discard_main_4
+#include "4.cc"
+#undef main
+
+#define main discard_main_5
+#include "5.cc"
+#undef main
+
+#define main discard_main_6
+#include "6.cc"
+#undef main
+
+#define main discard_main_7
+#include "7.cc"
+#undef main
+
+#define main discard_main_8
+#include "8.cc"
+#undef main
+
+#define main discard_main_9
+#include "9.cc"
+#undef main
+
+#define main discard_main_10
+#include "10.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ two.push_back(&test04);
+ two.push_back(&test05);
+ two.push_back(&test06);
+ two.push_back(&test07);
+ two.push_back(&test08);
+ two.push_back(&test09);
+ two.push_back(&test10);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/1.cc
new file mode 100644
index 000000000..232597531
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/1.cc
@@ -0,0 +1,83 @@
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010
+// Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.3.1 time_put members
+
+// { dg-do run { xfail dummy_wcsftime } }
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<wchar_t> iterator_type;
+
+ bool test __attribute__((unused)) = true;
+
+ // create "C" time objects
+ const tm time1 = __gnu_test::test_tm(0, 0, 12, 4, 3, 71, 0, 93, 0);
+
+ // basic construction
+ locale loc_c = locale::classic();
+
+ // create an ostream-derived object, cache the time_put facet
+ const wstring empty;
+ wostringstream oss;
+ oss.imbue(loc_c);
+ const time_put<wchar_t>& tim_put
+ = use_facet<time_put<wchar_t> >(oss.getloc());
+
+ // 1
+ // iter_type
+ // put(iter_type s, ios_base& str, char_type fill, const tm* t,
+ // char format, char modifier = 0) const;
+ oss.str(empty);
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'a');
+ wstring result1 = oss.str();
+ VERIFY( result1 == L"Sun" );
+
+ oss.str(empty);
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'x');
+ wstring result21 = oss.str(); // "04/04/71"
+ VERIFY( result21 == L"04/04/71" );
+
+ oss.str(empty);
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'X');
+ wstring result22 = oss.str(); // "12:00:00"
+ VERIFY( result22 == L"12:00:00" );
+
+ oss.str(empty);
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'x', 'E');
+ wstring result31 = oss.str(); // "04/04/71"
+ VERIFY( result31 == L"04/04/71" );
+
+ oss.str(empty);
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'X', 'E');
+ wstring result32 = oss.str(); // "12:00:00"
+ VERIFY( result32 == L"12:00:00" );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/10.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/10.cc
new file mode 100644
index 000000000..7e102346c
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/10.cc
@@ -0,0 +1,64 @@
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009
+// Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.3.1 time_put members
+
+// { dg-do run { xfail dummy_wcsftime } }
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test10()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ // Check time_put works with other iterators besides streambuf
+ // output iterators. (As long as output_iterator requirements are met.)
+ typedef wstring::iterator iter_type;
+ typedef char_traits<wchar_t> traits;
+ typedef time_put<wchar_t, iter_type> time_put_type;
+ const ios_base::iostate goodbit = ios_base::goodbit;
+
+ ios_base::iostate err = goodbit;
+ const locale loc_c = locale::classic();
+ const wstring x(50, 'x'); // have to have allocated wstring!
+ wstring res;
+ const tm time_sanity = __gnu_test::test_tm(0, 0, 12, 26, 5, 97, 2, 0, 0);
+
+ wostringstream oss;
+ oss.imbue(locale(loc_c, new time_put_type));
+ const time_put_type& tp = use_facet<time_put_type>(oss.getloc());
+
+ // 02 char format
+ res = x;
+ iter_type ret2 = tp.put(res.begin(), oss, L' ', &time_sanity, 'A');
+ wstring sanity2(res.begin(), ret2);
+ VERIFY( err == goodbit );
+ VERIFY( res == L"Tuesdayxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" );
+ VERIFY( sanity2 == L"Tuesday" );
+}
+
+int main()
+{
+ test10();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_1.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_1.cc
new file mode 100644
index 000000000..1298fa9e5
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_1.cc
@@ -0,0 +1,63 @@
+// Copyright (C) 2003, 2009, 2010 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <ctime>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+class TP : public std::time_put<wchar_t>
+{
+public:
+ mutable std::wstring fill_chars;
+
+protected:
+ iter_type do_put(iter_type s, std::ios_base&, char_type fill,
+ const std::tm*, char, char) const
+ {
+ fill_chars.push_back(fill);
+ return s;
+ }
+};
+
+// libstdc++/12439
+// time_put::put doesn't pass fill character to do_put
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ wostringstream stream;
+ time_t tt = time(0);
+
+ const wchar_t* fmt = L"%c";
+
+ TP tp;
+ tp.put(TP::iter_type(stream), stream, L'W', localtime(&tt),
+ fmt, fmt + wcslen(fmt));
+ VERIFY( !tp.fill_chars.empty() );
+ VERIFY( tp.fill_chars[tp.fill_chars.length() - 1] == L'W' );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_2.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_2.cc
new file mode 100644
index 000000000..c23135474
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_2.cc
@@ -0,0 +1,59 @@
+// Copyright (C) 2003, 2009, 2010 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <ctime>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+// libstdc++/12439
+// time_put::put writes narrowed characters to output iterator
+void test02()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ typedef time_put<wchar_t> tp_type;
+
+ const wchar_t fmt[] = {
+ 0xa0, 0x103, 0xfc, 0xb3, 0xa0c3,
+ L'%', L'c'
+ };
+
+ const size_t len = sizeof(fmt) / sizeof(fmt[0]);
+ const size_t cmplen = wcschr(fmt, L'%') - fmt;
+
+ locale loc;
+ const tp_type& tp = use_facet<tp_type>(loc);
+ time_t tt = time(0);
+ wostringstream stream;
+
+ tp.put(tp_type::iter_type(stream), stream, stream.fill(),
+ localtime(&tt), fmt, fmt + len);
+ wstring str = stream.str();
+ VERIFY( str.length() >= cmplen );
+ VERIFY( !wmemcmp(str.data(), fmt, cmplen) );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_3.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_3.cc
new file mode 100644
index 000000000..2ec4225ba
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/12439_3.cc
@@ -0,0 +1,61 @@
+// Copyright (C) 2003, 2009, 2010 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <ctime>
+#include <testsuite_hooks.h>
+
+class TP : public std::time_put<wchar_t>
+{
+public:
+ mutable std::string format_chars;
+
+protected:
+ iter_type do_put(iter_type s, std::ios_base&, char_type,
+ const std::tm*, char format, char) const
+ {
+ format_chars.push_back(format);
+ return s;
+ }
+};
+
+// libstdc++/12439
+// time_put::put reads past end of format string
+void test03()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ wostringstream stream;
+ time_t tt = time(0);
+
+ const wchar_t* fmt = L"%c";
+
+ TP tp;
+ tp.put(TP::iter_type(stream), stream, stream.fill(), localtime(&tt),
+ fmt, fmt + 1);
+ VERIFY( tp.format_chars.empty() );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/17038.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/17038.cc
new file mode 100644
index 000000000..2690a0b3c
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/17038.cc
@@ -0,0 +1,64 @@
+// { dg-require-namedlocale "ta_IN" }
+
+// 2004-08-25 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2004, 2005, 2006, 2009, 2010 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+// libstdc++/17038
+void test01()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<wchar_t> iterator_type;
+
+ bool test __attribute__((unused)) = true;
+
+ // create "C" time objects
+ const tm time1 = __gnu_test::test_tm(0, 0, 12, 4, 3, 71, 0, 93, 0);
+
+ // basic construction
+ locale loc_c = locale::classic();
+ locale loc_in = locale("ta_IN");
+ VERIFY( loc_in != loc_c );
+
+ // create an ostream-derived object, cache the time_put facet
+ wostringstream oss;
+ oss.imbue(loc_in);
+ const time_put<wchar_t>& tim_put =
+ use_facet<time_put<wchar_t> >(oss.getloc());
+
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'c');
+ wstring result1 = oss.str();
+
+ wchar_t time_buffer[128];
+ setlocale(LC_ALL, "ta_IN");
+ VERIFY( wcsftime(time_buffer, 128, L"%c", &time1) );
+
+ VERIFY( result1 == time_buffer );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/2.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/2.cc
new file mode 100644
index 000000000..d185fc475
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/2.cc
@@ -0,0 +1,80 @@
+// { dg-require-namedlocale "de_DE" }
+
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010
+// Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test02()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<wchar_t> iterator_type;
+
+ bool test __attribute__((unused)) = true;
+
+ // create "C" time objects
+ const tm time1 = __gnu_test::test_tm(0, 0, 12, 4, 3, 71, 0, 93, 0);
+
+ // basic construction and sanity check
+ locale loc_c = locale::classic();
+ locale loc_de = locale("de_DE");
+ VERIFY( loc_de != loc_c );
+
+ // create an ostream-derived object, cache the time_put facet
+ const wstring empty;
+ wostringstream oss;
+ oss.imbue(loc_de);
+ const time_put<wchar_t>& tim_put
+ = use_facet<time_put<wchar_t> >(oss.getloc());
+
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'a');
+ wstring result2 = oss.str();
+ VERIFY( result2 == L"Son" || result2 == L"So" );
+
+ oss.str(empty); // "%d.%m.%Y"
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'x');
+ wstring result23 = oss.str(); // "04.04.1971"
+ VERIFY( result23 == L"04.04.1971" );
+
+ oss.str(empty); // "%T"
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'X');
+ wstring result24 = oss.str(); // "12:00:00"
+ VERIFY( result24 == L"12:00:00" );
+
+ oss.str(empty);
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'x', 'E');
+ wstring result33 = oss.str(); // "04.04.1971"
+ VERIFY( result33 == L"04.04.1971" );
+
+ oss.str(empty);
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'X', 'E');
+ wstring result34 = oss.str(); // "12:00:00"
+ VERIFY( result34 == L"12:00:00" );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/3.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/3.cc
new file mode 100644
index 000000000..732b42a3d
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/3.cc
@@ -0,0 +1,80 @@
+// { dg-require-namedlocale "en_HK" }
+
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010
+// Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test03()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<wchar_t> iterator_type;
+
+ bool test __attribute__((unused)) = true;
+
+ // create "C" time objects
+ const tm time1 = __gnu_test::test_tm(0, 0, 12, 4, 3, 71, 0, 93, 0);
+
+ // basic construction and sanity check
+ locale loc_c = locale::classic();
+ locale loc_hk = locale("en_HK");
+ VERIFY( loc_hk != loc_c );
+
+ // create an ostream-derived object, cache the time_put facet
+ const wstring empty;
+ wostringstream oss;
+ oss.imbue(loc_hk);
+ const time_put<wchar_t>& tim_put
+ = use_facet<time_put<wchar_t> >(oss.getloc());
+
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'a');
+ wstring result3 = oss.str();
+ VERIFY( result3 == L"Sun" );
+
+ oss.str(empty); // "%A, %B %d, %Y"
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'x');
+ wstring result25 = oss.str(); // "Sunday, April 04, 1971"
+ VERIFY( result25 == L"Sunday, April 04, 1971" );
+
+ oss.str(empty); // "%I:%M:%S %Z"
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'X');
+ wstring result26 = oss.str(); // "12:00:00 CET" or whatever timezone
+ VERIFY( result26.find(L"12:00:00") != wstring::npos );
+
+ oss.str(empty);
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'x', 'E');
+ wstring result35 = oss.str(); // "Sunday, April 04, 1971"
+ VERIFY( result35 == L"Sunday, April 04, 1971" );
+
+ oss.str(empty);
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'X', 'E');
+ wstring result36 = oss.str(); // "12:00:00 CET"
+ VERIFY( result36.find(L"12:00:00") != wstring::npos );
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/4.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/4.cc
new file mode 100644
index 000000000..51a0ccbb4
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/4.cc
@@ -0,0 +1,81 @@
+// { dg-require-namedlocale "es_ES" }
+
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+// 2009, 2010
+// Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test04()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<wchar_t> iterator_type;
+
+ bool test __attribute__((unused)) = true;
+
+ // create "C" time objects
+ const tm time1 = __gnu_test::test_tm(0, 0, 12, 4, 3, 71, 0, 93, 0);
+
+ // basic construction and sanity check
+ locale loc_c = locale::classic();
+ locale loc_es = locale("es_ES");
+ VERIFY( loc_es != loc_c );
+
+ // create an ostream-derived object, cache the time_put facet
+ const wstring empty;
+ wostringstream oss;
+ oss.imbue(loc_es);
+ const time_put<wchar_t>& tim_put
+ = use_facet<time_put<wchar_t> >(oss.getloc());
+
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'a');
+ wstring result4 = oss.str();
+ VERIFY( result4 == L"dom" );
+
+ oss.str(empty); // "%d/%m/%y"
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'x');
+ wstring result27 = oss.str(); // "04/04/71"
+ VERIFY( result27 == L"04/04/71" );
+
+ oss.str(empty); // "%T"
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'X');
+ wstring result28 = oss.str(); // "12:00:00"
+ VERIFY( result28 == L"12:00:00" );
+
+ oss.str(empty);
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'x', 'E');
+ wstring result37 = oss.str(); // "04/04/71"
+ VERIFY( result37 == L"04/04/71" );
+
+ oss.str(empty);
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1, 'X', 'E');
+ wstring result38 = oss.str(); // "12:00:00"
+ VERIFY( result38 == L"12:00:00" );
+}
+
+int main()
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/5.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/5.cc
new file mode 100644
index 000000000..1a355e0a5
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/5.cc
@@ -0,0 +1,68 @@
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
+// Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.3.1 time_put members
+
+// { dg-do run { xfail dummy_wcsftime } }
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test05()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<wchar_t> iterator_type;
+ typedef char_traits<wchar_t> traits;
+
+ bool test __attribute__((unused)) = true;
+
+ // create "C" time objects
+ const tm time1 = __gnu_test::test_tm(0, 0, 12, 4, 3, 71, 0, 93, 0);
+ const wchar_t* date = L"%A, the second of %B";
+ const wchar_t* date_ex = L"%Ex";
+
+ // basic construction
+ locale loc_c = locale::classic();
+
+ // create an ostream-derived object, cache the time_put facet
+ const wstring empty;
+ wostringstream oss;
+ oss.imbue(loc_c);
+ const time_put<wchar_t>& tim_put
+ = use_facet<time_put<wchar_t> >(oss.getloc());
+
+ // 2
+ oss.str(empty);
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1,
+ date, date + traits::length(date));
+ wstring result5 = oss.str();
+ VERIFY( result5 == L"Sunday, the second of April");
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1,
+ date_ex, date_ex + traits::length(date_ex));
+ wstring result6 = oss.str();
+ VERIFY( result6 != result5 );
+}
+
+int main()
+{
+ test05();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/6.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/6.cc
new file mode 100644
index 000000000..3b18f2d72
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/6.cc
@@ -0,0 +1,68 @@
+// { dg-require-namedlocale "de_DE" }
+
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010
+// Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test06()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<wchar_t> iterator_type;
+ typedef char_traits<wchar_t> traits;
+
+ bool test __attribute__((unused)) = true;
+
+ // create "C" time objects
+ const tm time1 = __gnu_test::test_tm(0, 0, 12, 4, 3, 71, 0, 93, 0);
+ const wchar_t* date = L"%A, the second of %B";
+ const wchar_t* date_ex = L"%Ex";
+
+ // basic construction and sanity check
+ locale loc_c = locale::classic();
+ locale loc_de = locale("de_DE");
+ VERIFY( loc_de != loc_c );
+
+ // create an ostream-derived object, cache the time_put facet
+ const wstring empty;
+ wostringstream oss;
+ oss.imbue(loc_de);
+ const time_put<wchar_t>& tim_put
+ = use_facet<time_put<wchar_t> >(oss.getloc());
+
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1,
+ date, date + traits::length(date));
+ wstring result7 = oss.str();
+ VERIFY( result7 == L"Sonntag, the second of April");
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1,
+ date_ex, date_ex + traits::length(date));
+ wstring result8 = oss.str();
+ VERIFY( result8 != result7 );
+}
+
+int main()
+{
+ test06();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/7.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/7.cc
new file mode 100644
index 000000000..7f08c1ff3
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/7.cc
@@ -0,0 +1,68 @@
+// { dg-require-namedlocale "en_HK" }
+
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010
+// Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test07()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<wchar_t> iterator_type;
+ typedef char_traits<wchar_t> traits;
+
+ bool test __attribute__((unused)) = true;
+
+ // create "C" time objects
+ const tm time1 = __gnu_test::test_tm(0, 0, 12, 4, 3, 71, 0, 93, 0);
+ const wchar_t* date = L"%A, the second of %B";
+ const wchar_t* date_ex = L"%Ex";
+
+ // basic construction and sanity check
+ locale loc_c = locale::classic();
+ locale loc_hk = locale("en_HK");
+ VERIFY( loc_hk != loc_c );
+
+ // create an ostream-derived object, cache the time_put facet
+ const wstring empty;
+ wostringstream oss;
+ oss.imbue(loc_hk);
+ const time_put<wchar_t>& tim_put
+ = use_facet<time_put<wchar_t> >(oss.getloc());
+
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1,
+ date, date + traits::length(date));
+ wstring result9 = oss.str();
+ VERIFY( result9 == L"Sunday, the second of April");
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1,
+ date_ex, date_ex + traits::length(date));
+ wstring result10 = oss.str();
+ VERIFY( result10 != result9 );
+}
+
+int main()
+{
+ test07();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/8.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/8.cc
new file mode 100644
index 000000000..1042afb7c
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/8.cc
@@ -0,0 +1,68 @@
+// { dg-require-namedlocale "fr_FR@euro" }
+
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010
+// Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.3.1 time_put members
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test08()
+{
+ using namespace std;
+ typedef ostreambuf_iterator<wchar_t> iterator_type;
+ typedef char_traits<wchar_t> traits;
+
+ bool test __attribute__((unused)) = true;
+
+ // create "C" time objects
+ const tm time1 = __gnu_test::test_tm(0, 0, 12, 4, 3, 71, 0, 93, 0);
+ const wchar_t* date = L"%A, the second of %B";
+ const wchar_t* date_ex = L"%Ex";
+
+ // basic construction and sanity check
+ locale loc_c = locale::classic();
+ locale loc_fr = locale("fr_FR@euro");
+ VERIFY( loc_fr != loc_c );
+
+ // create an ostream-derived object, cache the time_put facet
+ const wstring empty;
+ wostringstream oss;
+ oss.imbue(loc_fr);
+ const time_put<wchar_t>& tim_put
+ = use_facet<time_put<wchar_t> >(oss.getloc());
+
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1,
+ date, date + traits::length(date));
+ wstring result11 = oss.str();
+ VERIFY( result11 == L"dimanche, the second of avril");
+ tim_put.put(oss.rdbuf(), oss, L'*', &time1,
+ date_ex, date_ex + traits::length(date));
+ wstring result12 = oss.str();
+ VERIFY( result12 != result11 );
+}
+
+int main()
+{
+ test08();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/9.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/9.cc
new file mode 100644
index 000000000..de1f2d44a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/9.cc
@@ -0,0 +1,66 @@
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009
+// Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.3.1 time_put members
+
+// { dg-do run { xfail dummy_wcsftime } }
+
+#include <locale>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void test09()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ // Check time_put works with other iterators besides streambuf
+ // output iterators. (As long as output_iterator requirements are met.)
+ typedef wstring::iterator iter_type;
+ typedef char_traits<wchar_t> traits;
+ typedef time_put<wchar_t, iter_type> time_put_type;
+ const ios_base::iostate goodbit = ios_base::goodbit;
+
+ ios_base::iostate err = goodbit;
+ const locale loc_c = locale::classic();
+ const wstring x(50, L'x'); // have to have allocated wstring!
+ wstring res;
+ const tm time_sanity = __gnu_test::test_tm(0, 0, 12, 26, 5, 97, 2, 0, 0);
+ const wchar_t* date = L"%X, %A, the second of %B, %Y";
+
+ wostringstream oss;
+ oss.imbue(locale(loc_c, new time_put_type));
+ const time_put_type& tp = use_facet<time_put_type>(oss.getloc());
+
+ // 01 date format
+ res = x;
+ iter_type ret1 = tp.put(res.begin(), oss, L' ', &time_sanity,
+ date, date + traits::length(date));
+ wstring sanity1(res.begin(), ret1);
+ VERIFY( err == goodbit );
+ VERIFY( res == L"12:00:00, Tuesday, the second of June, 1997xxxxxxx" );
+ VERIFY( sanity1 == L"12:00:00, Tuesday, the second of June, 1997" );
+}
+
+int main()
+{
+ test09();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/wrapped_env.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/wrapped_env.cc
new file mode 100644
index 000000000..495dcda9f
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/wrapped_env.cc
@@ -0,0 +1,85 @@
+// { dg-require-namedlocale "de_DE" }
+// { dg-require-namedlocale "en_HK" }
+// { dg-require-namedlocale "es_ES" }
+// { dg-require-namedlocale "fr_FR@euro" }
+
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+#define main discard_main_4
+#include "4.cc"
+#undef main
+
+#define main discard_main_5
+#include "5.cc"
+#undef main
+
+#define main discard_main_6
+#include "6.cc"
+#undef main
+
+#define main discard_main_7
+#include "7.cc"
+#undef main
+
+#define main discard_main_8
+#include "8.cc"
+#undef main
+
+#define main discard_main_9
+#include "9.cc"
+#undef main
+
+#define main discard_main_10
+#include "10.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ two.push_back(&test04);
+ two.push_back(&test05);
+ two.push_back(&test06);
+ two.push_back(&test07);
+ two.push_back(&test08);
+ two.push_back(&test09);
+ two.push_back(&test10);
+ run_tests_wrapped_env("de_DE", "LANG", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/wrapped_locale.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/wrapped_locale.cc
new file mode 100644
index 000000000..a99899938
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/wrapped_locale.cc
@@ -0,0 +1,86 @@
+// { dg-require-namedlocale "de_DE" }
+// { dg-require-namedlocale "en_HK" }
+// { dg-require-namedlocale "es_ES" }
+// { dg-require-namedlocale "fr_FR@euro" }
+// { dg-require-namedlocale "ja_JP.eucjp" }
+
+// 2001-08-15 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.4.1.1 collate members
+
+#include <testsuite_hooks.h>
+
+#define main discard_main_1
+#include "1.cc"
+#undef main
+
+#define main discard_main_2
+#include "2.cc"
+#undef main
+
+#define main discard_main_3
+#include "3.cc"
+#undef main
+
+#define main discard_main_4
+#include "4.cc"
+#undef main
+
+#define main discard_main_5
+#include "5.cc"
+#undef main
+
+#define main discard_main_6
+#include "6.cc"
+#undef main
+
+#define main discard_main_7
+#include "7.cc"
+#undef main
+
+#define main discard_main_8
+#include "8.cc"
+#undef main
+
+#define main discard_main_9
+#include "9.cc"
+#undef main
+
+#define main discard_main_10
+#include "10.cc"
+#undef main
+
+int main()
+{
+ using namespace __gnu_test;
+ func_callback two;
+ two.push_back(&test01);
+ two.push_back(&test02);
+ two.push_back(&test03);
+ two.push_back(&test04);
+ two.push_back(&test05);
+ two.push_back(&test06);
+ two.push_back(&test07);
+ two.push_back(&test08);
+ two.push_back(&test09);
+ two.push_back(&test10);
+ run_tests_wrapped_locale("ja_JP.eucjp", two);
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/requirements/base_classes.cc b/libstdc++-v3/testsuite/22_locale/time_put/requirements/base_classes.cc
new file mode 100644
index 000000000..4aa3f7fb9
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/requirements/base_classes.cc
@@ -0,0 +1,32 @@
+// { dg-do compile }
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2003, 2009 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.3 Template class time_put
+
+#include <locale>
+
+void test01()
+{
+ // Check for required base class.
+ typedef std::time_put<char> test_type;
+ typedef std::locale::facet base_type;
+ const test_type& obj = std::use_facet<test_type>(std::locale());
+ const base_type* base __attribute__((unused)) = &obj;
+}
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/22_locale/time_put/requirements/explicit_instantiation.cc
new file mode 100644
index 000000000..3d7225ead
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/requirements/explicit_instantiation.cc
@@ -0,0 +1,26 @@
+// { dg-do compile }
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2003, 2009 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.3 Template class time_put
+
+#include <locale>
+
+// Should be able to instantiate this for other types besides char, wchar_t
+template class std::time_put<unsigned char>;
diff --git a/libstdc++-v3/testsuite/22_locale/time_put/requirements/typedefs.cc b/libstdc++-v3/testsuite/22_locale/time_put/requirements/typedefs.cc
new file mode 100644
index 000000000..6457efff7
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/time_put/requirements/typedefs.cc
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// 2001-09-17 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2003, 2009 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 22.2.5.3 Template class time_put
+
+#include <locale>
+
+void test01()
+{
+ // Check for required typedefs
+ typedef std::time_put<char> test_type;
+ typedef test_type::char_type char_type;
+ typedef test_type::iter_type iter_type;
+}