summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/23_containers
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2010-02-01 13:10:12 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2010-02-01 13:10:12 +0000
commit522030b576d082baf6e9bbda2ef1a34e1b52f291 (patch)
tree128530f0def7d66d7ffa67a25ad568fb55f31215 /libstdc++-v3/testsuite/23_containers
parentbd0ed080850e2d6ff15a2b0df1e2ac5383a47ca7 (diff)
downloadgcc-522030b576d082baf6e9bbda2ef1a34e1b52f291.tar.gz
2010-02-01 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/forward_list.h (forward_list<>::resize(size_type), forward_list(size_type)): Only declare. * include/bits/forward_list.tcc (forward_list<>::resize(size_type), forward_list(size_type)): Define, don't assume CopyConstructible. * testsuite/23_containers/forward_list/cons/10.cc: New. * testsuite/23_containers/forward_list/modifiers/6.cc: Likewis. * testsuite/23_containers/forward_list/requirements/dr438/ assign_neg.cc: Adjust dg-error line numbers. * testsuite/23_containers/forward_list/requirements/dr438/ insert_neg.cc: Likewise. * testsuite/23_containers/forward_list/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/forward_list/requirements/dr438/ constructor_2_neg.cc: Likewise. * include/bits/forward_list.h: Use _M_get_Node_allocator throughout. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156426 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite/23_containers')
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/cons/10.cc50
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/modifiers/6.cc53
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc2
6 files changed, 107 insertions, 4 deletions
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/cons/10.cc b/libstdc++-v3/testsuite/23_containers/forward_list/cons/10.cc
new file mode 100644
index 00000000000..4e599dab6bc
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/cons/10.cc
@@ -0,0 +1,50 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-02-01 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 <forward_list>
+#include <testsuite_hooks.h>
+
+struct NoCopyConstructor
+{
+ NoCopyConstructor() : num(-1) { }
+ NoCopyConstructor(const NoCopyConstructor&) = delete;
+
+ operator int() { return num; }
+
+private:
+ int num;
+};
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::forward_list<NoCopyConstructor> fl(5);
+ VERIFY( std::distance(fl.begin(), fl.end()) == 5 );
+ for(auto it = fl.begin(); it != fl.end(); ++it)
+ VERIFY( *it == -1 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/modifiers/6.cc b/libstdc++-v3/testsuite/23_containers/forward_list/modifiers/6.cc
new file mode 100644
index 00000000000..985f592e602
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/modifiers/6.cc
@@ -0,0 +1,53 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2010-02-01 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 <forward_list>
+#include <testsuite_hooks.h>
+
+struct NoCopyConstructor
+{
+ NoCopyConstructor() : num(-1) { }
+ NoCopyConstructor(const NoCopyConstructor&) = delete;
+
+ operator int() { return num; }
+
+private:
+ int num;
+};
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::forward_list<NoCopyConstructor> fl;
+ VERIFY( std::distance(fl.begin(), fl.end()) == 0 );
+
+ fl.resize(10);
+ VERIFY( std::distance(fl.begin(), fl.end()) == 10 );
+ for(auto it = fl.begin(); it != fl.end(); ++it)
+ VERIFY( *it == -1 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc
index 7e6e6492a2c..5351a5b0788 100644
--- a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc
@@ -1,6 +1,6 @@
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
-// { dg-error "no matching" "" { target *-*-* } 1205 }
+// { dg-error "no matching" "" { target *-*-* } 1201 }
// { dg-excess-errors "" }
// Copyright (C) 2009, 2010 Free Software Foundation
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc
index 439a7b32191..b624ab2356f 100644
--- a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc
@@ -1,6 +1,6 @@
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
-// { dg-error "no matching" "" { target *-*-* } 1205 }
+// { dg-error "no matching" "" { target *-*-* } 1201 }
// { dg-excess-errors "" }
// Copyright (C) 2009, 2010 Free Software Foundation
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc
index 8184b67d750..0a593c83a91 100644
--- a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc
@@ -1,6 +1,6 @@
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
-// { dg-error "no matching" "" { target *-*-* } 1205 }
+// { dg-error "no matching" "" { target *-*-* } 1201 }
// { dg-excess-errors "" }
// Copyright (C) 2009, 2010 Free Software Foundation
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc
index 0bc1a3d58cb..4739ce77f75 100644
--- a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc
@@ -1,6 +1,6 @@
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
-// { dg-error "no matching" "" { target *-*-* } 1205 }
+// { dg-error "no matching" "" { target *-*-* } 1201 }
// { dg-excess-errors "" }
// Copyright (C) 2009, 2010 Free Software Foundation