summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/ext/vstring
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/ext/vstring
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/ext/vstring')
-rw-r--r--libstdc++-v3/testsuite/ext/vstring/assign/move_assign.cc54
-rw-r--r--libstdc++-v3/testsuite/ext/vstring/capacity/29134.cc37
-rw-r--r--libstdc++-v3/testsuite/ext/vstring/capacity/shrink_to_fit.cc42
-rw-r--r--libstdc++-v3/testsuite/ext/vstring/cons/moveable.cc63
-rw-r--r--libstdc++-v3/testsuite/ext/vstring/element_access/char/front_back.cc44
-rw-r--r--libstdc++-v3/testsuite/ext/vstring/element_access/wchar_t/front_back.cc44
-rw-r--r--libstdc++-v3/testsuite/ext/vstring/hash/char/1.cc54
-rw-r--r--libstdc++-v3/testsuite/ext/vstring/hash/wchar_t/1.cc54
-rw-r--r--libstdc++-v3/testsuite/ext/vstring/init-list.cc71
-rw-r--r--libstdc++-v3/testsuite/ext/vstring/inserters_extractors/char/28277.cc53
-rw-r--r--libstdc++-v3/testsuite/ext/vstring/inserters_extractors/wchar_t/28277.cc53
-rw-r--r--libstdc++-v3/testsuite/ext/vstring/operators/1.cc93
-rw-r--r--libstdc++-v3/testsuite/ext/vstring/operators/2.cc79
-rw-r--r--libstdc++-v3/testsuite/ext/vstring/range_access.cc37
-rw-r--r--libstdc++-v3/testsuite/ext/vstring/requirements/citerators.cc31
-rw-r--r--libstdc++-v3/testsuite/ext/vstring/requirements/dr438/constructor.cc31
-rw-r--r--libstdc++-v3/testsuite/ext/vstring/requirements/exception/basic.cc55
-rw-r--r--libstdc++-v3/testsuite/ext/vstring/requirements/exception/generation_prohibited.cc52
-rw-r--r--libstdc++-v3/testsuite/ext/vstring/requirements/exception/propagation_consistent.cc55
-rw-r--r--libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/1.cc27
-rw-r--r--libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/2.cc32
-rw-r--r--libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/char/1.cc31
-rw-r--r--libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/char16_t/1.cc34
-rw-r--r--libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/char32_t/1.cc34
-rw-r--r--libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/wchar_t/1.cc31
-rw-r--r--libstdc++-v3/testsuite/ext/vstring/requirements/typedefs.cc25
-rw-r--r--libstdc++-v3/testsuite/ext/vstring/types/23767.cc43
27 files changed, 1259 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/ext/vstring/assign/move_assign.cc b/libstdc++-v3/testsuite/ext/vstring/assign/move_assign.cc
new file mode 100644
index 000000000..3f9e055b8
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/vstring/assign/move_assign.cc
@@ -0,0 +1,54 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-string-conversions "" }
+
+// Copyright (C) 2010 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/>.
+
+// NOTE: This makes use of the fact that we know how moveable
+// is implemented on vstring (via swap). If the implementation changes
+// this test may begin to fail.
+
+#include <ext/vstring.h>
+#include <utility>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ __gnu_cxx::__sso_string a, b;
+ a.push_back('1');
+ b.assign(std::move(a));
+ VERIFY( b.size() == 1 && b[0] == '1' && a.size() == 0 );
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ __gnu_cxx::__rc_string a, b;
+ a.push_back('1');
+ b.assign(std::move(a));
+ VERIFY( b.size() == 1 && b[0] == '1' && a.size() == 0 );
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/vstring/capacity/29134.cc b/libstdc++-v3/testsuite/ext/vstring/capacity/29134.cc
new file mode 100644
index 000000000..b572f1eb7
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/vstring/capacity/29134.cc
@@ -0,0 +1,37 @@
+// Copyright (C) 2006, 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/>.
+
+// 21.3.3 basic_string capacity [lib.string.capacity]
+
+#include <ext/vstring.h>
+#include <testsuite_hooks.h>
+
+// libstdc++/29134
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ __gnu_cxx::__vstring vs;
+
+ VERIFY( vs.max_size() <= vs.get_allocator().max_size() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/vstring/capacity/shrink_to_fit.cc b/libstdc++-v3/testsuite/ext/vstring/capacity/shrink_to_fit.cc
new file mode 100644
index 000000000..bed965a5e
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/vstring/capacity/shrink_to_fit.cc
@@ -0,0 +1,42 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-01-08 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2010 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 <ext/vstring.h>
+#include <testsuite_hooks.h>
+
+// libstdc++/42573
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ __gnu_cxx::__vstring vs(100, 'a');
+ vs.push_back('b');
+ vs.push_back('b');
+ VERIFY( vs.size() < vs.capacity() );
+ vs.shrink_to_fit();
+ VERIFY( vs.size() == vs.capacity() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/vstring/cons/moveable.cc b/libstdc++-v3/testsuite/ext/vstring/cons/moveable.cc
new file mode 100644
index 000000000..b2572b2dd
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/vstring/cons/moveable.cc
@@ -0,0 +1,63 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-string-conversions "" }
+
+// Copyright (C) 2007, 2008, 2009, 2010 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/>.
+
+
+// NOTE: This makes use of the fact that we know how moveable
+// is implemented on vstring (via swap). If the implementation changes
+// this test may begin to fail.
+
+#include <ext/vstring.h>
+#include <utility>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ __gnu_cxx::__sso_string a,b;
+ a.push_back('1');
+ b = std::move(a);
+ VERIFY( b.size() == 1 && b[0] == '1' && a.size() == 0 );
+
+ __gnu_cxx::__sso_string c(std::move(b));
+ VERIFY( c.size() == 1 && c[0] == '1' );
+ VERIFY( b.size() == 0 );
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ __gnu_cxx::__rc_string a,b;
+ a.push_back('1');
+ b = std::move(a);
+ VERIFY( b.size() == 1 && b[0] == '1' && a.size() == 0 );
+
+ __gnu_cxx::__rc_string c(std::move(b));
+ VERIFY( c.size() == 1 && c[0] == '1' );
+ VERIFY( b.size() == 0 );
+}
+
+int main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/vstring/element_access/char/front_back.cc b/libstdc++-v3/testsuite/ext/vstring/element_access/char/front_back.cc
new file mode 100644
index 000000000..a1d4c5f02
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/vstring/element_access/char/front_back.cc
@@ -0,0 +1,44 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-string-conversions "" }
+
+// 2007-10-16 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2007, 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/>.
+
+#include <ext/vstring.h>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ __gnu_cxx::__vstring str("ramifications");
+ const __gnu_cxx::__vstring cstr("melodien");
+
+ VERIFY( str.front() == 'r' );
+ VERIFY( str.back() == 's' );
+ VERIFY( cstr.front() == 'm' );
+ VERIFY( cstr.back() == 'n' );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/vstring/element_access/wchar_t/front_back.cc b/libstdc++-v3/testsuite/ext/vstring/element_access/wchar_t/front_back.cc
new file mode 100644
index 000000000..6e45bc55e
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/vstring/element_access/wchar_t/front_back.cc
@@ -0,0 +1,44 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-string-conversions "" }
+
+// 2007-10-16 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2007, 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/>.
+
+#include <ext/vstring.h>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ __gnu_cxx::__wvstring str(L"ramifications");
+ const __gnu_cxx::__wvstring cstr(L"melodien");
+
+ VERIFY( str.front() == L'r' );
+ VERIFY( str.back() == L's' );
+ VERIFY( cstr.front() == L'm' );
+ VERIFY( cstr.back() == L'n' );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/vstring/hash/char/1.cc b/libstdc++-v3/testsuite/ext/vstring/hash/char/1.cc
new file mode 100644
index 000000000..94dce3787
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/vstring/hash/char/1.cc
@@ -0,0 +1,54 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-string-conversions "" }
+
+// Copyright (C) 2011 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 <ext/vstring.h>
+#include <unordered_map>
+#include <testsuite_hooks.h>
+
+// libstdc++/47773
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef __gnu_cxx::__vstring vstring_t;
+ typedef std::unordered_map<vstring_t, int> map_t;
+
+ map_t mymap;
+
+ mymap.insert(std::make_pair("hello", 10));
+ mymap.insert(std::make_pair("hi", 20));
+
+ VERIFY( mymap.size() == 2 );
+
+ map_t::const_iterator imap1 = mymap.begin();
+ map_t::const_iterator imap2 = mymap.begin();
+ ++imap2;
+
+ VERIFY( ((imap1->first == "hello" && imap1->second == 10
+ && imap2->first == "hi" && imap2->second == 20)
+ || (imap1->first == "hi" && imap1->second == 20
+ && imap2->first == "hello" && imap2->second == 10)) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/vstring/hash/wchar_t/1.cc b/libstdc++-v3/testsuite/ext/vstring/hash/wchar_t/1.cc
new file mode 100644
index 000000000..d23a882de
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/vstring/hash/wchar_t/1.cc
@@ -0,0 +1,54 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-string-conversions "" }
+
+// Copyright (C) 2011 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 <ext/vstring.h>
+#include <unordered_map>
+#include <testsuite_hooks.h>
+
+// libstdc++/47773
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef __gnu_cxx::__wvstring vstring_t;
+ typedef std::unordered_map<vstring_t, int> map_t;
+
+ map_t mymap;
+
+ mymap.insert(std::make_pair(L"hello", 10));
+ mymap.insert(std::make_pair(L"hi", 20));
+
+ VERIFY( mymap.size() == 2 );
+
+ map_t::const_iterator imap1 = mymap.begin();
+ map_t::const_iterator imap2 = mymap.begin();
+ ++imap2;
+
+ VERIFY( ((imap1->first == L"hello" && imap1->second == 10
+ && imap2->first == L"hi" && imap2->second == 20)
+ || (imap1->first == L"hi" && imap1->second == 20
+ && imap2->first == L"hello" && imap2->second == 10)) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/vstring/init-list.cc b/libstdc++-v3/testsuite/ext/vstring/init-list.cc
new file mode 100644
index 000000000..1d9279f0f
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/vstring/init-list.cc
@@ -0,0 +1,71 @@
+// Copyright (C) 2008, 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/>.
+//
+
+// { dg-options "-std=gnu++0x" }
+// { dg-require-string-conversions "" }
+
+#include <ext/vstring.h>
+#include <testsuite_hooks.h>
+
+int test01(void)
+{
+ bool test = true;
+
+ __gnu_cxx::__vstring s1 = { 'a', 'b', 'c' };
+ VERIFY(s1 == "abc");
+
+ s1 = { 'd', 'e', 'f' };
+ VERIFY(s1 == "def");
+
+ s1 += { 'g', 'h', 'i' };
+ VERIFY(s1 == "defghi");
+
+ s1.append({ 'j', 'k', 'l' });
+ VERIFY(s1 == "defghijkl");
+
+ s1.assign({ 'm', 'n', 'o' });
+ VERIFY(s1 == "mno");
+
+ // There aren't actually overloads of insert and replace taking size_type
+ // and initializer_list, but test the usage anyway.
+ s1.insert(2, { 'p', 'q', 'r' });
+ VERIFY(s1 == "mnpqro");
+
+ s1.replace(2, 3, { 's', 't', 'u' });
+ VERIFY(s1 == "mnstuo");
+
+ __gnu_cxx::__vstring::iterator i1, i2;
+
+ i1 = s1.begin()+2;
+ s1.insert(i1, { 'v', 'w', 'x' });
+ VERIFY(s1 == "mnvwxstuo");
+
+ i1 = s1.begin()+2;
+ i2 = i1+6;
+ s1.replace(i1, i2, { 'y', 'z' });
+ VERIFY(s1 == "mnyzo");
+
+ return test;
+}
+
+int main()
+{
+ __gnu_test::set_memory_limits();
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/vstring/inserters_extractors/char/28277.cc b/libstdc++-v3/testsuite/ext/vstring/inserters_extractors/char/28277.cc
new file mode 100644
index 000000000..b16980ec6
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/vstring/inserters_extractors/char/28277.cc
@@ -0,0 +1,53 @@
+// 2007-04-09 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2007, 2008, 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/>.
+
+// { dg-options "-DWIDTH=200000" { target simulator } }
+
+#include <ostream>
+#include <sstream>
+#include <ext/vstring.h>
+#include <testsuite_hooks.h>
+
+#ifndef WIDTH
+#define WIDTH 20000000
+#endif
+
+// libstdc++/28277
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ ostringstream oss_01;
+ const __gnu_cxx::__vstring str_01(50, 'a');
+
+ oss_01.width(WIDTH);
+ const streamsize width = oss_01.width();
+
+ oss_01 << str_01;
+
+ VERIFY( oss_01.good() );
+ VERIFY( oss_01.str().size() == __gnu_cxx::__vstring::size_type(width) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/vstring/inserters_extractors/wchar_t/28277.cc b/libstdc++-v3/testsuite/ext/vstring/inserters_extractors/wchar_t/28277.cc
new file mode 100644
index 000000000..ad122bd54
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/vstring/inserters_extractors/wchar_t/28277.cc
@@ -0,0 +1,53 @@
+// 2007-04-09 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2007, 2008, 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/>.
+
+// { dg-options "-DWIDTH=500000" { target simulator } }
+
+#include <ostream>
+#include <sstream>
+#include <ext/vstring.h>
+#include <testsuite_hooks.h>
+
+#ifndef WIDTH
+#define WIDTH 50000000
+#endif
+
+// libstdc++/28277
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ wostringstream oss_01;
+ const __gnu_cxx::__wvstring str_01(50, L'a');
+
+ oss_01.width(WIDTH);
+ const streamsize width = oss_01.width();
+
+ oss_01 << str_01;
+
+ VERIFY( oss_01.good() );
+ VERIFY( oss_01.str().size() == __gnu_cxx::__wvstring::size_type(width) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/vstring/operators/1.cc b/libstdc++-v3/testsuite/ext/vstring/operators/1.cc
new file mode 100644
index 000000000..f7cb7992d
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/vstring/operators/1.cc
@@ -0,0 +1,93 @@
+// 2010-12-15 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2010 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/>.
+//
+// { dg-options "-std=gnu++0x" }
+// { dg-require-string-conversions "" }
+
+#include <ext/vstring.h>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using __gnu_cxx::__vstring;
+
+ VERIFY( (__vstring("abc") + __vstring("def")
+ == __vstring("abcdef")) );
+ __vstring s1("abc");
+ VERIFY( s1 + __vstring("def") == __vstring("abcdef") );
+ __vstring s2("def");
+ VERIFY( __vstring("abc") + s2 == __vstring("abcdef") );
+ VERIFY( __vstring("abc") + 'd' == __vstring("abcd") );
+ VERIFY( __vstring("abc") + "def" == __vstring("abcdef") );
+ VERIFY( 'a' + __vstring("bcd") == __vstring("abcd") );
+ VERIFY( "abc" + __vstring("def") == __vstring("abcdef") );
+
+ VERIFY( (__vstring("abcdefghij") + __vstring("klmnopqrst")
+ == __vstring("abcdefghijklmnopqrst")) );
+ __vstring s1l("abcdefghij");
+ VERIFY( (s1l + __vstring("klmnopqrst")
+ == __vstring("abcdefghijklmnopqrst")) );
+ __vstring s2l("klmnopqrst");
+ VERIFY( (__vstring("abcdefghij") + s2l
+ == __vstring("abcdefghijklmnopqrst")) );
+ VERIFY( (__vstring("abcdefghijklmno") + 'p'
+ == __vstring("abcdefghijklmnop")) );
+ VERIFY( (__vstring("abcdefghijklmno") + "pqrst"
+ == __vstring("abcdefghijklmnopqrst")) );
+ VERIFY( ('a' + __vstring("bcdefghijklmnop")
+ == __vstring("abcdefghijklmnop")) );
+ VERIFY( ("abcde" + __vstring("fghijklmnopqrst")
+ == __vstring("abcdefghijklmnopqrst")) );
+
+ VERIFY( (__vstring("abcdefghijklmnopqrst") + __vstring("uvwxy")
+ == __vstring("abcdefghijklmnopqrstuvwxy")) );
+ VERIFY( (__vstring("abcde") + __vstring("fghijklmnopqrstuvwxy")
+ == __vstring("abcdefghijklmnopqrstuvwxy")) );
+ __vstring s1ll1("abcdefghijklmnopqrst");
+ VERIFY( (s1ll1 + __vstring("uvwxy")
+ == __vstring("abcdefghijklmnopqrstuvwxy")) );
+ __vstring s1ll2("abcde");
+ VERIFY( (s1ll2 + __vstring("fghijklmnopqrstuvwxy")
+ == __vstring("abcdefghijklmnopqrstuvwxy")) );
+ __vstring s2ll1("fghijklmnopqrstuvwxy");
+ VERIFY( (__vstring("abcde") + s2ll1
+ == __vstring("abcdefghijklmnopqrstuvwxy")) );
+ __vstring s2ll2("uvwxy");
+ VERIFY( (__vstring("abcdefghijklmnopqrst") + s2ll2
+ == __vstring("abcdefghijklmnopqrstuvwxy")) );
+ VERIFY( (__vstring("abcdefghijklmnopqrst") + 'u'
+ == __vstring("abcdefghijklmnopqrstu")) );
+ VERIFY( (__vstring("abcdefghijklmnopqrst") + "uvwxy"
+ == __vstring("abcdefghijklmnopqrstuvwxy")) );
+ VERIFY( (__vstring("abcde") + "fghijklmnopqrstuvwxy"
+ == __vstring("abcdefghijklmnopqrstuvwxy")) );
+ VERIFY( ('a' + __vstring("bcdefghijklmnopqrstuvwxy")
+ == __vstring("abcdefghijklmnopqrstuvwxy")) );
+ VERIFY( ("abcde" + __vstring("fghijklmnopqrstuvwxy")
+ == __vstring("abcdefghijklmnopqrstuvwxy")) );
+ VERIFY( ("abcdefghijklmnopqrst" + __vstring("uvwxy")
+ == __vstring("abcdefghijklmnopqrstuvwxy")) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/vstring/operators/2.cc b/libstdc++-v3/testsuite/ext/vstring/operators/2.cc
new file mode 100644
index 000000000..7561fbda3
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/vstring/operators/2.cc
@@ -0,0 +1,79 @@
+// 2010-12-19 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2010 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/>.
+//
+// { dg-options "-std=gnu++0x" }
+// { dg-require-string-conversions "" }
+
+#include <ext/vstring.h>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using __gnu_cxx::__vstring;
+ using std::move;
+
+ __vstring s01("abc");
+ s01.reserve(30);
+ __vstring s02("def");
+ s02.reserve(30);
+ VERIFY( move(s01) + move(s02) == __vstring("abcdef") );
+
+ __vstring s03("abcdefghijklmnopqrstuvw");
+ __vstring s04("xyz");
+ s04.reserve(30);
+ VERIFY( move(s03) + move(s04) == __vstring("abcdefghijklmnopqrstuvwxyz") );
+
+ __vstring s05("abc");
+ s05.reserve(30);
+ __vstring s06("defghijklmnopqrstuvwxyz");
+ VERIFY( move(s05) + move(s06) == __vstring("abcdefghijklmnopqrstuvwxyz") );
+
+ const __vstring sc1("abc");
+ __vstring s07("def");
+ s07.reserve(30);
+ VERIFY( sc1 + move(s07) == __vstring("abcdef") );
+
+ const __vstring sc2("def");
+ __vstring s08("abc");
+ s08.reserve(30);
+ VERIFY( move(s08) + sc2 == __vstring("abcdef") );
+
+ __vstring s09("abc");
+ s09.reserve(30);
+ VERIFY( move(s09) + 'd' == __vstring("abcd") );
+
+ __vstring s10("abc");
+ s10.reserve(30);
+ VERIFY( move(s10) + "def" == __vstring("abcdef") );
+
+ __vstring s11("bcd");
+ s11.reserve(30);
+ VERIFY( 'a' + move(s11) == __vstring("abcd") );
+
+ __vstring s12("def");
+ s12.reserve(30);
+ VERIFY( "abc" + move(s12) == __vstring("abcdef") );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/vstring/range_access.cc b/libstdc++-v3/testsuite/ext/vstring/range_access.cc
new file mode 100644
index 000000000..f734e92c7
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/vstring/range_access.cc
@@ -0,0 +1,37 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2010 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/>.
+
+// 24.6.5, range access [iterator.range]
+
+#include <ext/vstring.h>
+
+void
+test01()
+{
+ __gnu_cxx::__vstring s("Hello, World!");
+ std::begin(s);
+ std::end(s);
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ __gnu_cxx::__wvstring ws(L"Hello, World!");
+ std::begin(ws);
+ std::end(ws);
+#endif
+}
diff --git a/libstdc++-v3/testsuite/ext/vstring/requirements/citerators.cc b/libstdc++-v3/testsuite/ext/vstring/requirements/citerators.cc
new file mode 100644
index 000000000..582cadac3
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/vstring/requirements/citerators.cc
@@ -0,0 +1,31 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-string-conversions "" }
+
+// 2007-10-15 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2007, 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 <ext/vstring.h>
+#include <testsuite_containers.h>
+
+int main()
+{
+ typedef __gnu_cxx::__vstring test_type;
+ __gnu_test::citerator<test_type> test;
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/vstring/requirements/dr438/constructor.cc b/libstdc++-v3/testsuite/ext/vstring/requirements/dr438/constructor.cc
new file mode 100644
index 000000000..df493ca0d
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/vstring/requirements/dr438/constructor.cc
@@ -0,0 +1,31 @@
+// 2007-04-27 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2007, 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/>.
+
+// { dg-do compile }
+
+#include <ext/vstring.h>
+
+void f()
+{
+ __gnu_cxx::__versa_string<char, std::char_traits<char>,
+ std::allocator<char>, __gnu_cxx::__sso_string_base> vs(10, 1);
+
+ __gnu_cxx::__versa_string<char, std::char_traits<char>,
+ std::allocator<char>, __gnu_cxx::__rc_string_base> vr(10, 1);
+}
diff --git a/libstdc++-v3/testsuite/ext/vstring/requirements/exception/basic.cc b/libstdc++-v3/testsuite/ext/vstring/requirements/exception/basic.cc
new file mode 100644
index 000000000..a0042d488
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/vstring/requirements/exception/basic.cc
@@ -0,0 +1,55 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// 2009-11-10 Benjamin Kosnik <benjamin@redhat.com>
+
+// Copyright (C) 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 <ext/vstring.h>
+#include <exception/safety.h>
+
+void
+value()
+{
+#if 1
+ typedef char value_type;
+#else
+ // XXX
+ // __gnu_cxx::__rc_string_base<>::_Rep::_M_align’ with constructor
+ // not allowed in union
+ // typedef __gnu_cxx::throw_value_limit value_type;
+#endif
+ typedef __gnu_cxx::throw_allocator_limit<value_type> allocator_type;
+ typedef std::char_traits<value_type> traits_type;
+
+ typedef __gnu_cxx::__versa_string<value_type, traits_type,
+ allocator_type, __gnu_cxx::__rc_string_base> test_type_rc;
+
+ typedef __gnu_cxx::__versa_string<value_type, traits_type,
+ allocator_type, __gnu_cxx::__sso_string_base> test_type_sso;
+
+ __gnu_test::basic_safety<test_type_rc> test_rc;
+ __gnu_test::basic_safety<test_type_sso> test_sso;
+}
+
+// Container requirement testing, exceptional behavior
+int main()
+{
+ value();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/vstring/requirements/exception/generation_prohibited.cc b/libstdc++-v3/testsuite/ext/vstring/requirements/exception/generation_prohibited.cc
new file mode 100644
index 000000000..4ffe0df3b
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/vstring/requirements/exception/generation_prohibited.cc
@@ -0,0 +1,52 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// 2009-09-14 Benjamin Kosnik <benjamin@redhat.com>
+
+// Copyright (C) 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 <ext/vstring.h>
+#include <exception/safety.h>
+
+void
+char_instance()
+{
+ typedef char value_type;
+ typedef __gnu_cxx::throw_allocator_random<value_type> allocator_type;
+ typedef std::char_traits<value_type> traits_type;
+ typedef __gnu_cxx::__versa_string<value_type, traits_type, allocator_type> test_type;
+ __gnu_test::generation_prohibited<test_type> test;
+}
+
+void
+wchar_instance()
+{
+ typedef wchar_t value_type;
+ typedef __gnu_cxx::throw_allocator_random<value_type> allocator_type;
+ typedef std::char_traits<value_type> traits_type;
+ typedef __gnu_cxx::__versa_string<value_type, traits_type, allocator_type> test_type;
+ __gnu_test::generation_prohibited<test_type> test;
+}
+
+// Container requirement testing, exceptional behavior
+int main()
+{
+ char_instance();
+ wchar_instance();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/vstring/requirements/exception/propagation_consistent.cc b/libstdc++-v3/testsuite/ext/vstring/requirements/exception/propagation_consistent.cc
new file mode 100644
index 000000000..09d8618ab
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/vstring/requirements/exception/propagation_consistent.cc
@@ -0,0 +1,55 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// 2009-09-14 Benjamin Kosnik <benjamin@redhat.com>
+
+// Copyright (C) 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 <ext/vstring.h>
+#include <exception/safety.h>
+
+void
+value()
+{
+#if 1
+ typedef char value_type;
+#else
+ // XXX
+ // __gnu_cxx::__rc_string_base<>::_Rep::_M_align’ with constructor
+ // not allowed in union
+ // typedef __gnu_cxx::throw_value_limit value_type;
+#endif
+ typedef __gnu_cxx::throw_allocator_limit<value_type> allocator_type;
+ typedef std::char_traits<value_type> traits_type;
+
+ typedef __gnu_cxx::__versa_string<value_type, traits_type,
+ allocator_type, __gnu_cxx::__rc_string_base> test_type_rc;
+
+ typedef __gnu_cxx::__versa_string<value_type, traits_type,
+ allocator_type, __gnu_cxx::__sso_string_base> test_type_sso;
+
+ __gnu_test::propagation_consistent<test_type_rc> test_rc;
+ __gnu_test::propagation_consistent<test_type_sso> test_sso;
+}
+
+// Container requirement testing, exceptional behavior
+int main()
+{
+ value();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/1.cc
new file mode 100644
index 000000000..81d6ce732
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/1.cc
@@ -0,0 +1,27 @@
+// Copyright (C) 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/>.
+
+
+// This file tests explicit instantiation of __versa_string
+
+#include <ext/vstring.h>
+
+// { dg-do compile }
+
+// libstdc++/21770
+template class __gnu_cxx::__versa_string<int, std::char_traits<int>,
+ std::allocator<char> >;
diff --git a/libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/2.cc
new file mode 100644
index 000000000..3423b76be
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/2.cc
@@ -0,0 +1,32 @@
+// Copyright (C) 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/>.
+
+
+// This file tests explicit instantiation of __versa_string
+
+#include <ext/vstring.h>
+
+// { dg-do compile }
+
+// libstdc++/21770
+template class __gnu_cxx::__versa_string<int, std::char_traits<int>,
+ std::allocator<char>,
+ __gnu_cxx::__sso_string_base>;
+
+template class __gnu_cxx::__versa_string<int, std::char_traits<int>,
+ std::allocator<char>,
+ __gnu_cxx::__rc_string_base>;
diff --git a/libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/char/1.cc b/libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/char/1.cc
new file mode 100644
index 000000000..6e0972a39
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/char/1.cc
@@ -0,0 +1,31 @@
+// Copyright (C) 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/>.
+
+
+// This file tests explicit instantiation of __versa_string
+
+#include <ext/vstring.h>
+
+// { dg-do compile }
+
+template class __gnu_cxx::__versa_string<char, std::char_traits<char>,
+ std::allocator<char>,
+ __gnu_cxx::__sso_string_base>;
+
+template class __gnu_cxx::__versa_string<char, std::char_traits<char>,
+ std::allocator<char>,
+ __gnu_cxx::__rc_string_base>;
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
index 000000000..f6f7d4141
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/char16_t/1.cc
@@ -0,0 +1,34 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-string-conversions "" }
+
+// Copyright (C) 2008, 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/>.
+
+
+// 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
index 000000000..0020792cc
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/char32_t/1.cc
@@ -0,0 +1,34 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-string-conversions "" }
+
+// Copyright (C) 2008, 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/>.
+
+
+// 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>;
diff --git a/libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/wchar_t/1.cc b/libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/wchar_t/1.cc
new file mode 100644
index 000000000..964832803
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/vstring/requirements/explicit_instantiation/wchar_t/1.cc
@@ -0,0 +1,31 @@
+// Copyright (C) 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/>.
+
+
+// This file tests explicit instantiation of __versa_string
+
+#include <ext/vstring.h>
+
+// { dg-do compile }
+
+template class __gnu_cxx::__versa_string<wchar_t, std::char_traits<wchar_t>,
+ std::allocator<wchar_t>,
+ __gnu_cxx::__sso_string_base>;
+
+template class __gnu_cxx::__versa_string<wchar_t, std::char_traits<wchar_t>,
+ std::allocator<wchar_t>,
+ __gnu_cxx::__rc_string_base>;
diff --git a/libstdc++-v3/testsuite/ext/vstring/requirements/typedefs.cc b/libstdc++-v3/testsuite/ext/vstring/requirements/typedefs.cc
new file mode 100644
index 000000000..06db6afc3
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/vstring/requirements/typedefs.cc
@@ -0,0 +1,25 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 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 <testsuite_containers.h>
+#include <ext/vstring.h>
+
+// Check container for required typedefs.
+__gnu_test::types<__gnu_cxx::__vstring> t;
diff --git a/libstdc++-v3/testsuite/ext/vstring/types/23767.cc b/libstdc++-v3/testsuite/ext/vstring/types/23767.cc
new file mode 100644
index 000000000..a963f2712
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/vstring/types/23767.cc
@@ -0,0 +1,43 @@
+// 2005-09-12 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 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/>.
+//
+
+// { dg-do compile }
+
+#include <ext/vstring.h>
+
+struct T
+{
+ typedef __gnu_cxx::__vstring Vstring;
+ typedef Vstring::iterator iterator;
+ typedef Vstring::const_iterator const_iterator;
+
+ char t(iterator f) { return *f; }
+ char t(const_iterator f) const { return *f; }
+};
+
+// libstdc++/23767
+void f()
+{
+ __gnu_cxx::__vstring vs;
+ T t;
+ T::const_iterator i = vs.begin();
+
+ t.t(i);
+}