PR libstdc++/33979 (partial)
authorPaolo Carlini <paolo.carlini@oracle.com>
Wed, 20 Aug 2008 19:29:54 +0000 (19:29 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Wed, 20 Aug 2008 19:29:54 +0000 (19:29 +0000)
2008-08-20  Paolo Carlini  <paolo.carlini@oracle.com>

PR libstdc++/33979 (partial)
* include/bits/postypes.h (u16streampos, u32streampos): Add.
* include/bits/char_traits.h (char_traits<char16_t>,
char_traits<char32_t>): Add.
* include/bits/stringfwd.h (u16string, u32string): Add.
* include/ext/vstring_fwd.h: Add typedefs for char16_t/char32_t.
* testsuite/21_strings/char_traits/requirements/char32_t/typedefs.cc:
New.
* testsuite/21_strings/char_traits/requirements/
explicit_instantiation/short/1.cc: Likewise.
* testsuite/21_strings/char_traits/requirements/
explicit_instantiation/char32_t/1.cc: Likewise.
* testsuite/21_strings/char_traits/requirements/
explicit_instantiation/wchar_t/1.cc: Likewise.
* testsuite/21_strings/char_traits/requirements/
explicit_instantiation/char16_t/1.cc: Likewise.
* testsuite/21_strings/char_traits/requirements/
explicit_instantiation/char/1.cc: Likewise.
* testsuite/21_strings/char_traits/requirements/char16_t/typedefs.cc:
Likewise.
* testsuite/21_strings/basic_string/requirements/
explicit_instantiation/char32_t/1.cc: Likewise.
* testsuite/21_strings/basic_string/requirements/
explicit_instantiation/wchar_t/1.cc: Likewise.
* testsuite/21_strings/basic_string/requirements/
explicit_instantiation/char16_t/1.cc: Likewise.
* testsuite/21_strings/basic_string/requirements/
explicit_instantiation/char/1.cc: Likewise.
* testsuite/21_strings/headers/string/types_std_c++0x.cc: Likewise.
* testsuite/ext/vstring/requirements/explicit_instantiation/
char32_t/1.cc: Likewise.
* testsuite/ext/vstring/requirements/explicit_instantiation/
char16_t/1.cc: Likewise.

From-SVN: r139339

19 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/char_traits.h
libstdc++-v3/include/bits/postypes.h
libstdc++-v3/include/bits/stringfwd.h
libstdc++-v3/include/ext/vstring_fwd.h
libstdc++-v3/testsuite/21_strings/basic_string/requirements/explicit_instantiation/char/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/requirements/explicit_instantiation/char16_t/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/requirements/explicit_instantiation/char32_t/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/basic_string/requirements/explicit_instantiation/wchar_t/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/char_traits/requirements/char16_t/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/char_traits/requirements/char32_t/typedefs.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/char/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/char16_t/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/char32_t/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/short/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/wchar_t/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/21_strings/headers/string/types_std_c++0x.cc [new file with mode: 0644]
libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/char16_t/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/char32_t/1.cc [new file with mode: 0644]

index ab960cb..f4d076e 100644 (file)
@@ -1,3 +1,39 @@
+2008-08-20  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR libstdc++/33979 (partial)
+       * include/bits/postypes.h (u16streampos, u32streampos): Add.
+       * include/bits/char_traits.h (char_traits<char16_t>,
+       char_traits<char32_t>): Add.
+       * include/bits/stringfwd.h (u16string, u32string): Add.
+       * include/ext/vstring_fwd.h: Add typedefs for char16_t/char32_t.
+       * testsuite/21_strings/char_traits/requirements/char32_t/typedefs.cc:
+       New.
+       * testsuite/21_strings/char_traits/requirements/
+       explicit_instantiation/short/1.cc: Likewise.
+       * testsuite/21_strings/char_traits/requirements/
+       explicit_instantiation/char32_t/1.cc: Likewise.
+       * testsuite/21_strings/char_traits/requirements/
+       explicit_instantiation/wchar_t/1.cc: Likewise.
+       * testsuite/21_strings/char_traits/requirements/
+       explicit_instantiation/char16_t/1.cc: Likewise.
+       * testsuite/21_strings/char_traits/requirements/
+       explicit_instantiation/char/1.cc: Likewise.
+       * testsuite/21_strings/char_traits/requirements/char16_t/typedefs.cc:
+       Likewise.
+       * testsuite/21_strings/basic_string/requirements/
+       explicit_instantiation/char32_t/1.cc: Likewise.
+       * testsuite/21_strings/basic_string/requirements/
+       explicit_instantiation/wchar_t/1.cc: Likewise.
+       * testsuite/21_strings/basic_string/requirements/
+       explicit_instantiation/char16_t/1.cc: Likewise.
+       * testsuite/21_strings/basic_string/requirements/
+       explicit_instantiation/char/1.cc: Likewise.
+       * testsuite/21_strings/headers/string/types_std_c++0x.cc: Likewise.
+       * testsuite/ext/vstring/requirements/explicit_instantiation/
+       char32_t/1.cc: Likewise.
+       * testsuite/ext/vstring/requirements/explicit_instantiation/
+       char16_t/1.cc: Likewise.
+
 2008-08-18  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR libstdc++/37149
index 52158ef..9dac222 100644 (file)
@@ -374,6 +374,195 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 
 _GLIBCXX_END_NAMESPACE
 
+#if (defined(__GXX_EXPERIMENTAL_CXX0X__) \
+     && defined(_GLIBCXX_USE_C99_STDINT_TR1))
+
+#include <cstdint>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+  template<>
+    struct char_traits<char16_t>
+    {
+      typedef char16_t          char_type;
+      typedef uint_least16_t    int_type;
+      typedef streamoff         off_type;
+      typedef u16streampos      pos_type;
+      typedef mbstate_t         state_type;
+
+      static void
+      assign(char_type& __c1, const char_type& __c2)
+      { __c1 = __c2; }
+
+      static bool
+      eq(const char_type& __c1, const char_type& __c2)
+      { return __c1 == __c2; }
+
+      static bool
+      lt(const char_type& __c1, const char_type& __c2)
+      { return __c1 < __c2; }
+
+      static int
+      compare(const char_type* __s1, const char_type* __s2, size_t __n)
+      {
+       for (size_t __i = 0; __i < __n; ++__i)
+         if (lt(__s1[__i], __s2[__i]))
+           return -1;
+         else if (lt(__s2[__i], __s1[__i]))
+           return 1;
+       return 0;
+      }
+
+      static size_t
+      length(const char_type* __s)
+      {
+       size_t __i = 0;
+       while (!eq(__s[__i], char_type()))
+         ++__i;
+       return __i;
+      }
+
+      static const char_type*
+      find(const char_type* __s, size_t __n, const char_type& __a)
+      {
+       for (size_t __i = 0; __i < __n; ++__i)
+         if (eq(__s[__i], __a))
+           return __s + __i;
+       return 0;
+      }
+
+      static char_type*
+      move(char_type* __s1, const char_type* __s2, size_t __n)
+      {
+       return (static_cast<char_type*>
+               (__builtin_memmove(__s1, __s2, __n * sizeof(char_type))));
+      }
+
+      static char_type*
+      copy(char_type* __s1, const char_type* __s2, size_t __n)
+      {
+       return (static_cast<char_type*>
+               (__builtin_memcpy(__s1, __s2, __n * sizeof(char_type))));
+      }
+
+      static char_type*
+      assign(char_type* __s, size_t __n, char_type __a)
+      { 
+       std::fill_n(__s, __n, __a);
+       return __s;
+      }
+
+      static char_type
+      to_char_type(const int_type& __c) { return char_type(__c); }
+
+      static int_type
+      to_int_type(const char_type& __c) { return int_type(__c); }
+
+      static bool
+      eq_int_type(const int_type& __c1, const int_type& __c2)
+      { return __c1 == __c2; }
+
+      static int_type
+      eof() { return static_cast<int_type>(-1); }
+
+      static int_type
+      not_eof(const int_type& __c)
+      { return eq_int_type(__c, eof()) ? 0 : __c; }
+    };
+
+  template<>
+    struct char_traits<char32_t>
+    {
+      typedef char32_t          char_type;
+      typedef uint_least32_t    int_type;
+      typedef streamoff         off_type;
+      typedef u32streampos      pos_type;
+      typedef mbstate_t         state_type;
+
+      static void
+      assign(char_type& __c1, const char_type& __c2)
+      { __c1 = __c2; }
+
+      static bool
+      eq(const char_type& __c1, const char_type& __c2)
+      { return __c1 == __c2; }
+
+      static bool
+      lt(const char_type& __c1, const char_type& __c2)
+      { return __c1 < __c2; }
+
+      static int
+      compare(const char_type* __s1, const char_type* __s2, size_t __n)
+      {
+       for (size_t __i = 0; __i < __n; ++__i)
+         if (lt(__s1[__i], __s2[__i]))
+           return -1;
+         else if (lt(__s2[__i], __s1[__i]))
+           return 1;
+       return 0;
+      }
+
+      static size_t
+      length(const char_type* __s)
+      {
+       size_t __i = 0;
+       while (!eq(__s[__i], char_type()))
+         ++__i;
+       return __i;
+      }
+
+      static const char_type*
+      find(const char_type* __s, size_t __n, const char_type& __a)
+      {
+       for (size_t __i = 0; __i < __n; ++__i)
+         if (eq(__s[__i], __a))
+           return __s + __i;
+       return 0;
+      }
+
+      static char_type*
+      move(char_type* __s1, const char_type* __s2, size_t __n)
+      {
+       return (static_cast<char_type*>
+               (__builtin_memmove(__s1, __s2, __n * sizeof(char_type))));
+      }
+
+      static char_type*
+      copy(char_type* __s1, const char_type* __s2, size_t __n)
+      { 
+       return (static_cast<char_type*>
+               (__builtin_memcpy(__s1, __s2, __n * sizeof(char_type))));
+      }
+
+      static char_type*
+      assign(char_type* __s, size_t __n, char_type __a)
+      {
+       std::fill_n(__s, __n, __a);
+       return __s;
+      }
+
+      static char_type
+      to_char_type(const int_type& __c) { return char_type(__c); }
+
+      static int_type
+      to_int_type(const char_type& __c) { return int_type(__c); }
+
+      static bool
+      eq_int_type(const int_type& __c1, const int_type& __c2)
+      { return __c1 == __c2; }
+
+      static int_type
+      eof() { return static_cast<int_type>(-1); }
+
+      static int_type
+      not_eof(const int_type& __c)
+      { return eq_int_type(__c, eof()) ? 0 : __c; }
+    };
+
+_GLIBCXX_END_NAMESPACE
+
+#endif 
+
 #undef _CHAR_TRAITS_EOF
 
-#endif
+#endif // _CHAR_TRAITS_H
index 1bc972a..6d57a24 100644 (file)
@@ -222,6 +222,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   /// File position for wchar_t streams.
   typedef fpos<mbstate_t> wstreampos;
 
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+  /// File position for char16_t streams.
+  typedef fpos<mbstate_t> u16streampos;
+  /// File position for char32_t streams.
+  typedef fpos<mbstate_t> u32streampos;
+#endif
+
 _GLIBCXX_END_NAMESPACE
 
 #endif
index d27ef14..10ecfd7 100644 (file)
@@ -1,6 +1,7 @@
 // String support -*- C++ -*-
 
-// Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+// 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
@@ -65,6 +66,17 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   typedef basic_string<wchar_t> wstring;
 #endif
 
+#if (defined(__GXX_EXPERIMENTAL_CXX0X__) \
+     && defined(_GLIBCXX_USE_C99_STDINT_TR1))
+
+  template<> struct char_traits<char16_t>;
+  template<> struct char_traits<char32_t>;
+
+  typedef basic_string<char16_t> u16string;
+  typedef basic_string<char32_t> u32string;
+
+#endif
+
 _GLIBCXX_END_NAMESPACE
 
 #endif // _STRINGFWD_H
index bc11d60..1dd0b65 100644 (file)
@@ -1,6 +1,6 @@
 // Versatile string forward -*- C++ -*-
 
-// Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2007, 2008 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
@@ -70,6 +70,23 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
                 std::allocator<wchar_t>, __rc_string_base> __wrc_string;
 #endif  
 
+#if (defined(__GXX_EXPERIMENTAL_CXX0X__) \
+     && defined(_GLIBCXX_USE_C99_STDINT_TR1))
+
+  typedef __versa_string<char16_t>                          __u16vstring;
+  typedef __u16vstring                                      __u16sso_string;
+  typedef 
+  __versa_string<char16_t, std::char_traits<char16_t>,
+                std::allocator<char16_t>, __rc_string_base> __u16rc_string;
+
+  typedef __versa_string<char32_t>                          __u32vstring;
+  typedef __u32vstring                                      __u32sso_string;
+  typedef 
+  __versa_string<char32_t, std::char_traits<char32_t>,
+                std::allocator<char32_t>, __rc_string_base> __u32rc_string;
+
+#endif
+
 _GLIBCXX_END_NAMESPACE
 
 #endif /* _VSTRING_FWD_H */
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/requirements/explicit_instantiation/char/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/requirements/explicit_instantiation/char/1.cc
new file mode 100644 (file)
index 0000000..95b6846
--- /dev/null
@@ -0,0 +1,23 @@
+// { dg-do compile }
+
+// Copyright (C) 2008 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 2, 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 COPYING.  If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+#include <string>
+
+template class std::basic_string<char>;
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/requirements/explicit_instantiation/char16_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/requirements/explicit_instantiation/char16_t/1.cc
new file mode 100644 (file)
index 0000000..27401fe
--- /dev/null
@@ -0,0 +1,25 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// Copyright (C) 2008 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 2, 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 COPYING.  If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+#include <string>
+
+template class std::basic_string<char16_t>;
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/requirements/explicit_instantiation/char32_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/requirements/explicit_instantiation/char32_t/1.cc
new file mode 100644 (file)
index 0000000..cdc6a82
--- /dev/null
@@ -0,0 +1,25 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// Copyright (C) 2008 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 2, 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 COPYING.  If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+#include <string>
+
+template class std::basic_string<char32_t>;
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/requirements/explicit_instantiation/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/requirements/explicit_instantiation/wchar_t/1.cc
new file mode 100644 (file)
index 0000000..fcf0dad
--- /dev/null
@@ -0,0 +1,23 @@
+// { dg-do compile }
+
+// Copyright (C) 2008 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 2, 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 COPYING.  If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+#include <string>
+
+template class std::basic_string<wchar_t>;
diff --git a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char16_t/typedefs.cc b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char16_t/typedefs.cc
new file mode 100644 (file)
index 0000000..dd7de95
--- /dev/null
@@ -0,0 +1,41 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// Copyright (C) 2008 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 2, 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 COPYING.  If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+#include <string>
+#include <cstdint>
+
+int main()
+{
+  // Check for required typedefs.
+  typedef std::char_traits<char16_t> test_type;
+  typedef test_type::char_type char_type;
+  typedef test_type::int_type int_type;
+  typedef test_type::off_type off_type;
+  typedef test_type::pos_type pos_type;
+  typedef test_type::state_type state_type;
+
+  // char_traits<char16_t>::int_type == uint_least16_t
+  test_type::int_type* p = 0;
+  std::uint_least16_t* q __attribute__((unused)) = p;                   
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char32_t/typedefs.cc b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char32_t/typedefs.cc
new file mode 100644 (file)
index 0000000..819a78c
--- /dev/null
@@ -0,0 +1,41 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// Copyright (C) 2008 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 2, 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 COPYING.  If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+#include <string>
+#include <cstdint>
+
+int main()
+{
+  // Check for required typedefs.
+  typedef std::char_traits<char32_t> test_type;
+  typedef test_type::char_type char_type;
+  typedef test_type::int_type int_type;
+  typedef test_type::off_type off_type;
+  typedef test_type::pos_type pos_type;
+  typedef test_type::state_type state_type;
+
+  // char_traits<char16_t>::int_type == uint_least32_t
+  test_type::int_type* p = 0;
+  std::uint_least32_t* q __attribute__((unused)) = p;                   
+
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/char/1.cc b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/char/1.cc
new file mode 100644 (file)
index 0000000..6bb5a7e
--- /dev/null
@@ -0,0 +1,23 @@
+// { dg-do compile }
+
+// Copyright (C) 2008 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 2, 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 COPYING.  If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+#include <string>
+
+template class std::char_traits<char>;
diff --git a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/char16_t/1.cc b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/char16_t/1.cc
new file mode 100644 (file)
index 0000000..9626e10
--- /dev/null
@@ -0,0 +1,25 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// Copyright (C) 2008 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 2, 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 COPYING.  If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+#include <string>
+
+template class std::char_traits<char16_t>;
diff --git a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/char32_t/1.cc b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/char32_t/1.cc
new file mode 100644 (file)
index 0000000..be94c6c
--- /dev/null
@@ -0,0 +1,25 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// Copyright (C) 2008 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 2, 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 COPYING.  If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+#include <string>
+
+template class std::char_traits<char32_t>;
diff --git a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/short/1.cc b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/short/1.cc
new file mode 100644 (file)
index 0000000..d31c325
--- /dev/null
@@ -0,0 +1,23 @@
+// { dg-do compile }
+
+// Copyright (C) 2008 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 2, 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 COPYING.  If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+#include <string>
+
+template class std::char_traits<short>;
diff --git a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/wchar_t/1.cc
new file mode 100644 (file)
index 0000000..dbe5362
--- /dev/null
@@ -0,0 +1,23 @@
+// { dg-do compile }
+
+// Copyright (C) 2008 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 2, 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 COPYING.  If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+#include <string>
+
+template class std::char_traits<wchar_t>;
diff --git a/libstdc++-v3/testsuite/21_strings/headers/string/types_std_c++0x.cc b/libstdc++-v3/testsuite/21_strings/headers/string/types_std_c++0x.cc
new file mode 100644 (file)
index 0000000..b26463d
--- /dev/null
@@ -0,0 +1,29 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// Copyright (C) 2008 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 2, 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 COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <string>
+
+namespace gnu
+{
+  typedef std::u16string t3;
+  typedef std::u32string t4;
+}
diff --git a/libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/char16_t/1.cc b/libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/char16_t/1.cc
new file mode 100644 (file)
index 0000000..7f62f3e
--- /dev/null
@@ -0,0 +1,42 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// Copyright (C) 2008 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 2, 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 COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// This file tests explicit instantiation of __versa_string
+
+#include <ext/vstring.h>
+
+template class __gnu_cxx::__versa_string<char16_t, std::char_traits<char16_t>,
+                                        std::allocator<char16_t>,
+                                        __gnu_cxx::__sso_string_base>;
+
+template class __gnu_cxx::__versa_string<char16_t, std::char_traits<char16_t>,
+                                        std::allocator<char16_t>,
+                                        __gnu_cxx::__rc_string_base>;
diff --git a/libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/char32_t/1.cc b/libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/char32_t/1.cc
new file mode 100644 (file)
index 0000000..6fd0b78
--- /dev/null
@@ -0,0 +1,42 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// Copyright (C) 2008 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 2, 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 COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// This file tests explicit instantiation of __versa_string
+
+#include <ext/vstring.h>
+
+template class __gnu_cxx::__versa_string<char32_t, std::char_traits<char32_t>,
+                                        std::allocator<char32_t>,
+                                        __gnu_cxx::__sso_string_base>;
+
+template class __gnu_cxx::__versa_string<char32_t, std::char_traits<char32_t>,
+                                        std::allocator<char32_t>,
+                                        __gnu_cxx::__rc_string_base>;