summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/23_containers/array/requirements
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/testsuite/23_containers/array/requirements')
-rw-r--r--libstdc++-v3/testsuite/23_containers/array/requirements/citerators.cc30
-rw-r--r--libstdc++-v3/testsuite/23_containers/array/requirements/constexpr_functions.cc54
-rw-r--r--libstdc++-v3/testsuite/23_containers/array/requirements/explicit_instantiation/1.cc23
-rw-r--r--libstdc++-v3/testsuite/23_containers/array/requirements/explicit_instantiation/2.cc27
-rw-r--r--libstdc++-v3/testsuite/23_containers/array/requirements/explicit_instantiation/3.cc30
-rw-r--r--libstdc++-v3/testsuite/23_containers/array/requirements/fill.cc46
-rw-r--r--libstdc++-v3/testsuite/23_containers/array/requirements/typedefs.cc25
7 files changed, 235 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/23_containers/array/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/array/requirements/citerators.cc
new file mode 100644
index 000000000..c448a8419
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/array/requirements/citerators.cc
@@ -0,0 +1,30 @@
+// { dg-options "-std=gnu++0x" }
+
+// 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 <array>
+#include <testsuite_containers.h>
+
+int main()
+{
+ typedef std::array<int, 7> test_type;
+ __gnu_test::citerator<test_type> test;
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/array/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/23_containers/array/requirements/constexpr_functions.cc
new file mode 100644
index 000000000..ef8c5aac7
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/array/requirements/constexpr_functions.cc
@@ -0,0 +1,54 @@
+// { 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/>.
+
+#include <array>
+#include <testsuite_common_types.h>
+
+namespace __gnu_test
+{
+ struct constexpr_member_functions
+ {
+ template<typename _Ttesttype>
+ void
+ operator()()
+ {
+ struct _Concept
+ {
+ void __constraint()
+ {
+ constexpr _Ttesttype a = { };
+ constexpr auto v1 __attribute__((unused)) = a.size();
+ constexpr auto v2 __attribute__((unused)) = a.max_size();
+ constexpr auto v3 __attribute__((unused)) = a.empty();
+ }
+ };
+
+ _Concept c;
+ c.__constraint();
+ }
+ };
+}
+
+int main()
+{
+ __gnu_test::constexpr_member_functions test;
+ test.operator()<std::array<long, 60>>();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/array/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/23_containers/array/requirements/explicit_instantiation/1.cc
new file mode 100644
index 000000000..0e1044124
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/array/requirements/explicit_instantiation/1.cc
@@ -0,0 +1,23 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// 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 <array>
+
+template class std::array<int, 5>;
diff --git a/libstdc++-v3/testsuite/23_containers/array/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/23_containers/array/requirements/explicit_instantiation/2.cc
new file mode 100644
index 000000000..aadf76b72
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/array/requirements/explicit_instantiation/2.cc
@@ -0,0 +1,27 @@
+// { 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/>.
+
+// This file tests explicit instantiation of library containers
+
+#include <array>
+#include <testsuite_hooks.h>
+#include <testsuite_api.h>
+
+template class std::array<__gnu_test::NonDefaultConstructible, 3>;
diff --git a/libstdc++-v3/testsuite/23_containers/array/requirements/explicit_instantiation/3.cc b/libstdc++-v3/testsuite/23_containers/array/requirements/explicit_instantiation/3.cc
new file mode 100644
index 000000000..9bd5bc9c0
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/array/requirements/explicit_instantiation/3.cc
@@ -0,0 +1,30 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// 2010-05-20 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/>.
+
+// This file tests explicit instantiation of library containers
+
+#include <array>
+#include <testsuite_hooks.h>
+#include <testsuite_api.h>
+
+// libstdc++/41792
+template class std::array<__gnu_test::OverloadedAddress, 3>;
diff --git a/libstdc++-v3/testsuite/23_containers/array/requirements/fill.cc b/libstdc++-v3/testsuite/23_containers/array/requirements/fill.cc
new file mode 100644
index 000000000..5586b7062
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/array/requirements/fill.cc
@@ -0,0 +1,46 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2008-06-13 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// 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/>.
+
+#include <array>
+#include <testsuite_hooks.h>
+
+// DR 776. Undescribed assign function of std::array.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ const size_t len = 3;
+ typedef std::array<int, len> array_type;
+
+ array_type a = { { 0, 1, 2 } };
+ const int value = 5;
+
+ a.fill(value);
+ VERIFY( a[0] == value );
+ VERIFY( a[1] == value );
+ VERIFY( a[2] == value );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/array/requirements/typedefs.cc b/libstdc++-v3/testsuite/23_containers/array/requirements/typedefs.cc
new file mode 100644
index 000000000..152988df7
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/array/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 <array>
+
+// Check container for required typedefs.
+__gnu_test::types<std::array<int, 10> > t;