===================================================================
@@ -1,3 +1,59 @@
+2011-09-16 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * testsuite/23_containers/array/comparison_operators/
+ less_or_equal.cc: New.
+ * testsuite/23_containers/array/comparison_operators/
+ greater_or_equal.cc: Likewise.
+ * testsuite/23_containers/array/comparison_operators/less.cc: Likewise.
+ * testsuite/23_containers/array/comparison_operators/equal.cc: Likewise.
+ * testsuite/23_containers/array/comparison_operators/not_equal.cc:
+ Likewise.
+ * testsuite/23_containers/array/comparison_operators/greater.cc:
+ Likewise.
+ * testsuite/23_containers/array/iterators/end_is_one_past.cc: Likewise.
+ * testsuite/23_containers/array/capacity/empty.cc: Likewise.
+ * testsuite/23_containers/array/capacity/max_size.cc: Likewise.
+ * testsuite/23_containers/array/capacity/size.cc: Likewise.
+ * testsuite/23_containers/array/tuple_interface/tuple_element.cc:
+ Likewise.
+ * testsuite/23_containers/array/tuple_interface/tuple_size.cc:
+ Likewise.
+ * testsuite/23_containers/array/element_access/at_out_of_range.cc:
+ Likewise.
+ * testsuite/23_containers/array/element_access/back.cc: Likewise.
+ * testsuite/23_containers/array/element_access/front.cc: Likewise.
+ * testsuite/23_containers/array/element_access/data.cc: Likewise.
+ * testsuite/23_containers/array/cons/aggregate_initialization.cc:
+ Likewise.
+ * testsuite/23_containers/array/requirements/zero_sized_arrays.cc:
+ Likewise.
+ * testsuite/23_containers/array/requirements/contiguous.cc: Likewise.
+ * testsuite/23_containers/array/requirements/member_swap.cc: Likewise.
+ * testsuite/23_containers/array/specialized_algorithms/swap.cc:
+ Likewise.
+ * testsuite/23_containers/array/constexpr_get.cc: Move...
+ * testsuite/23_containers/array/tuple_interface/constexpr_get.cc:
+ ... here.
+ * testsuite/23_containers/array/requirements/get.cc: Move...
+ * testsuite/23_containers/array/tuple_interface/get: ... here.
+ * testsuite/23_containers/array/at_neg.cc: Move...
+ * testsuite/23_containers/array/element_access: ... here.
+ * testsuite/23_containers/array/requirements/constexpr_functions.cc:
+ Move...
+ * testsuite/23_containers/array/capacity: ... here.
+ * testsuite/23_containers/array/requirements/
+ constexpr_element_access.cc: Move...
+ * testsuite/23_containers/array/element_access: ... here.
+
+ * testsuite/20_util/duration/cons/1_neg.cc: Avoid -Wall warnings.
+ * testsuite/20_util/tuple/creation_functions/constexpr.cc: Likewise.
+ * testsuite/20_util/pair/make_pair/constexpr.cc: Likewise.
+ * testsuite/20_util/time_point/nonmember/constexpr.cc: Likewise.
+ * testsuite/23_containers/bitset/operations/constexpr.cc: Likewise.
+
+ * testsuite/20_util/duration/cons/1_neg.cc: Discard bogus warning.
+ * testsuite/20_util/forward/1_neg.cc: Likewise.
+
2011-09-15 Paolo Carlini <paolo.carlini@oracle.com>
* include/std/tuple (make_tuple, forward_as_tuple): Declare constexpr.
===================================================================
@@ -26,15 +26,15 @@
typedef std::_Base_bitset<6> bitset_base;
constexpr bitset_base base = bitset_base();
- constexpr auto r1 = base._M_getword(2);
+ constexpr auto r1 __attribute__((unused)) = base._M_getword(2);
// constexpr auto r2 = base._M_getdata(); // error, pointer to this
- auto r2 = base._M_getdata();
- constexpr auto r3 = base._M_hiword();
+ auto r2 __attribute__((unused)) = base._M_getdata();
+ constexpr auto r3 __attribute__((unused)) = base._M_hiword();
// bitset operators
typedef std::bitset<6> bitset_type;
constexpr bitset_type a = bitset_type();
- constexpr auto v = a[0];
+ constexpr auto v __attribute__((unused)) = a[0];
return 0;
}
===================================================================
@@ -1,31 +0,0 @@
-// { dg-do run { xfail *-*-* } }
-// { dg-options "-std=gnu++0x" }
-
-// 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 Pred 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>
-
-int main()
-{
- // Expected behavior is to either throw and have the uncaught
- // exception end up in a terminate handler which eventually exits,
- // or abort. (Depending on -fno-exceptions.)
- constexpr std::array<int, 3> a{{1, 2, 3}};
- auto i = a.at(4);
- return 0;
-}
===================================================================
@@ -0,0 +1,38 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+//
+// 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 <array>
+
+void
+test01()
+{
+ typedef std::array<int, 5> array_type;
+
+ array_type a = { { 0, 1, 2, 3, 4 } };
+ array_type b = { { 0, 1, 2, 3 } };
+
+ a = b;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
===================================================================
@@ -1,53 +0,0 @@
-// { dg-do compile }
-// { dg-options "-std=gnu++0x" }
-
-// Copyright (C) 2010, 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 <array>
-
-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;
-}
===================================================================
@@ -0,0 +1,59 @@
+// { dg-options "-std=gnu++0x" }
+//
+// 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 <array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ const size_t len = 0;
+ typedef std::array<int, len> array_type;
+
+ // 1: ?
+ array_type a = { };
+
+ // 2
+ array_type b;
+
+ // 3
+ // begin() == end()
+ VERIFY( a.begin() == a.end() );
+ VERIFY( b.begin() == b.end() );
+
+ // 4: ?
+ // begin() == end() == unique value.
+ {
+ typedef std::array<long, len> array_type1;
+ typedef std::array<char, len> array_type2;
+ array_type1 one;
+ array_type2 two;
+ void* v1 = one.begin();
+ void* v2 = two.begin();
+ VERIFY( v1 != v2 );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
===================================================================
@@ -1,31 +0,0 @@
-// { dg-do compile }
-// { dg-options "-std=gnu++0x" }
-
-// 2011-05-16 Paolo Carlini <paolo.carlini@oracle.com>
-//
-// 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 <array>
-
-void test01()
-{
- std::array<int, 2> a;
-
- int&& aone __attribute__((unused)) = std::get<0>(std::move(a));
- int&& atwo __attribute__((unused)) = std::get<1>(std::move(a));
-}
===================================================================
@@ -1,31 +0,0 @@
-// { dg-do compile }
-// { dg-options "-std=gnu++0x" }
-
-// 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 <array>
-
-int main()
-{
- // array
- typedef std::array<std::size_t, 6> array_type;
- constexpr array_type a = { 0, 55, 66, 99, 4115, 2 };
- constexpr auto v1 = a[1];
- constexpr auto v2 = a.at(2);
- return 0;
-}
===================================================================
@@ -0,0 +1,43 @@
+// { dg-options "-std=gnu++0x" }
+//
+// 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 <array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ const size_t len = 5;
+ typedef std::array<int, len> array_type;
+ array_type a = { { 0, 1, 2, 3, 4 } };
+
+ // &a[n] == &a[0] + n for all 0 <= n < N.
+ for (size_t i = 0; i < len; ++i)
+ {
+ VERIFY( &a[i] == &a[0] + i );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
===================================================================
@@ -0,0 +1,46 @@
+// { dg-options "-std=gnu++0x" }
+//
+// 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 <array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ const size_t len = 5;
+ typedef std::array<int, len> array_type;
+
+ array_type a = { { 0, 1, 2, 3, 4 } };
+ const array_type a_ref = a;
+
+ array_type b = { { 4, 3, 2, 1, 0 } };
+ const array_type b_ref = b;
+
+ a.swap(b);
+ VERIFY( a == b_ref );
+ VERIFY( b == a_ref );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
===================================================================
@@ -0,0 +1,46 @@
+// { dg-options "-std=gnu++0x" }
+//
+// 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 <array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ const size_t len = 5;
+ typedef std::array<int, len> array_type;
+
+ array_type a = { { 0, 1, 2, 3, 4 } };
+ const array_type a_ref = a;
+
+ array_type b = { { 4, 3, 2, 1, 0 } };
+ const array_type b_ref = b;
+
+ std::swap(a, b);
+ VERIFY( a == b_ref );
+ VERIFY( b == a_ref );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
===================================================================
@@ -1,30 +0,0 @@
-// { dg-options "-std=gnu++0x" }
-// { dg-do compile }
-
-// 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/>.
-
-// Tuple
-
-#include <array>
-
-std::array<int, 5> ai;
-const std::array<int, 5> cai(ai);
-
-constexpr const int& cri = std::get<0>(cai);
-constexpr int& ri = std::get<0>(ai);
-constexpr int&& rri = std::get<0>(std::move(ai));
===================================================================
@@ -0,0 +1,41 @@
+// { dg-options "-std=gnu++0x" }
+//
+// 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 <array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ const size_t len = 5;
+ typedef std::array<int, len> array_type;
+ bool test __attribute__((unused)) = true;
+ array_type a = { { 0, 1, 2, 3, 4 } };
+ array_type b = { { 0, 1, 2, 3, 4 } };
+ array_type c = { { 0, 1, 2, 3, 7 } };
+
+ VERIFY( a <= b );
+ VERIFY( a <= c );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
===================================================================
@@ -0,0 +1,41 @@
+// { dg-options "-std=gnu++0x" }
+//
+// 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 <array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ const size_t len = 5;
+ typedef std::array<int, len> array_type;
+ bool test __attribute__((unused)) = true;
+ array_type a = { { 0, 1, 2, 3, 4 } };
+ array_type b = { { 0, 1, 2, 3, 4 } };
+ array_type c = { { 0, 1, 2, 3, 7 } };
+
+ VERIFY( a >= b );
+ VERIFY( c >= a );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
===================================================================
@@ -0,0 +1,42 @@
+// { dg-options "-std=gnu++0x" }
+//
+// Copyright (C) 2004, 2005, 2006, 2007, 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>
+
+void
+test01()
+{
+ const size_t len = 5;
+ typedef std::array<int, len> array_type;
+ bool test __attribute__((unused)) = true;
+ array_type a = { { 0, 1, 2, 3, 4 } };
+ array_type b = { { 0, 1, 2, 3, 4 } };
+ array_type c = { { 0, 1, 2, 3, 7 } };
+
+ VERIFY( !(a < b) );
+ VERIFY( a < c );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
===================================================================
@@ -0,0 +1,41 @@
+// { dg-options "-std=gnu++0x" }
+//
+// 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 <array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ const size_t len = 5;
+ typedef std::array<int, len> array_type;
+ bool test __attribute__((unused)) = true;
+ array_type a = { { 0, 1, 2, 3, 4 } };
+ array_type b = { { 0, 1, 2, 3, 4 } };
+ array_type c = { { 0, 1, 2, 3 } };
+
+ VERIFY( a == b );
+ VERIFY( !(a == c) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
===================================================================
@@ -0,0 +1,41 @@
+// { dg-options "-std=gnu++0x" }
+//
+// 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 <array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ const size_t len = 5;
+ typedef std::array<int, len> array_type;
+ bool test __attribute__((unused)) = true;
+ array_type a = { { 0, 1, 2, 3, 4 } };
+ array_type b = { { 0, 1, 2, 3, 4 } };
+ array_type c = { { 0, 1, 2, 3 } };
+
+ VERIFY( !(a != b) );
+ VERIFY( a != c );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
===================================================================
@@ -0,0 +1,41 @@
+// { dg-options "-std=gnu++0x" }
+//
+// 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 <array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ const size_t len = 5;
+ typedef std::array<int, len> array_type;
+ bool test __attribute__((unused)) = true;
+ array_type a = { { 0, 1, 2, 3, 4 } };
+ array_type b = { { 0, 1, 2, 3, 4 } };
+ array_type c = { { 0, 1, 2, 3, 7 } };
+
+ VERIFY( !(a > b) );
+ VERIFY( c > a );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
===================================================================
@@ -0,0 +1,49 @@
+// { dg-options "-std=gnu++0x" }
+//
+// 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 <array>
+#include <type_traits>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ {
+ const size_t len = 3;
+ typedef array<int, len> array_type;
+ VERIFY( (is_same<tuple_element<0, array_type>::type, int>::value == true) );
+ VERIFY( (is_same<tuple_element<1, array_type>::type, int>::value == true) );
+ VERIFY( (is_same<tuple_element<2, array_type>::type, int>::value == true) );
+ }
+
+ {
+ const size_t len = 0;
+ typedef array<int, len> array_type;
+ VERIFY( (is_same<tuple_element<0, array_type>::type, int>::value == true) );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
===================================================================
@@ -0,0 +1,46 @@
+// { dg-options "-std=gnu++0x" }
+//
+// 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 <array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ {
+ const size_t len = 5;
+ typedef array<int, len> array_type;
+ VERIFY( tuple_size<array_type>::value == 5 );
+ }
+
+ {
+ const size_t len = 0;
+ typedef array<float, len> array_type;
+ VERIFY( tuple_size<array_type>::value == 0 );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
===================================================================
@@ -0,0 +1,54 @@
+// { dg-options "-std=gnu++0x" }
+//
+// 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 <array>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ const size_t len = 5;
+ typedef std::array<int, len> array_type;
+ array_type a = { { 0, 1, 2, 3, 4 } };
+
+ try
+ {
+ a.at(len);
+ VERIFY( false );
+ }
+ catch(std::out_of_range& obj)
+ {
+ // Expected.
+ VERIFY( true );
+ }
+ catch(...)
+ {
+ // Failed.
+ VERIFY( false );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
===================================================================
@@ -26,6 +26,6 @@
// exception end up in a terminate handler which eventually exits,
// or abort. (Depending on -fno-exceptions.)
constexpr std::array<int, 3> a{{1, 2, 3}};
- auto i = a.at(4);
+ auto i __attribute__((unused)) = a.at(4);
return 0;
}
===================================================================
@@ -24,8 +24,8 @@
{
// array
typedef std::array<std::size_t, 6> array_type;
- constexpr array_type a = { 0, 55, 66, 99, 4115, 2 };
- constexpr auto v1 = a[1];
- constexpr auto v2 = a.at(2);
+ constexpr array_type a = { { 0, 55, 66, 99, 4115, 2 } };
+ constexpr auto v1 __attribute__((unused)) = a[1];
+ constexpr auto v2 __attribute__((unused)) = a.at(2);
return 0;
}
===================================================================
@@ -0,0 +1,48 @@
+// { dg-options "-std=gnu++0x" }
+//
+// 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 <array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ const size_t len = 5;
+ typedef std::array<int, len> array_type;
+
+ {
+ array_type a = { { 0, 1, 2, 3, 4 } };
+ int& ri = a.back();
+ VERIFY( ri == 4 );
+ }
+
+ {
+ const array_type ca = { { 4, 3, 2, 1, 0 } };
+ const int& cri = ca.back();
+ VERIFY( cri == 0 );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
===================================================================
@@ -0,0 +1,48 @@
+// { dg-options "-std=gnu++0x" }
+//
+// 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 <array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ const size_t len = 5;
+ typedef std::array<int, len> array_type;
+
+ {
+ array_type a = { { 0, 1, 2, 3, 4 } };
+ int& ri = a.front();
+ VERIFY( ri == 0 );
+ }
+
+ {
+ const array_type ca = { { 4, 3, 2, 1, 0 } };
+ const int& cri = ca.front();
+ VERIFY( cri == 4 );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
===================================================================
@@ -0,0 +1,48 @@
+// { dg-options "-std=gnu++0x" }
+//
+// 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 <array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ const size_t len = 5;
+ typedef std::array<int, len> array_type;
+
+ {
+ array_type a = { { 0, 1, 2, 3, 4 } };
+ int* pi = a.data();
+ VERIFY( *pi == 0 );
+ }
+
+ {
+ const array_type ca = { { 4, 3, 2, 1, 0 } };
+ const int* pci = ca.data();
+ VERIFY( *pci == 4 );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
===================================================================
@@ -0,0 +1,42 @@
+// { dg-options "-std=gnu++0x" }
+//
+// 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 <array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ const size_t len = 5;
+ typedef std::array<int, len> array_type;
+ array_type a = { { 0, 1, 2, 3, 4 } };
+
+ array_type::iterator b = a.begin();
+ array_type::iterator e = a.end();
+
+ VERIFY( e != (b + a.size() - 1) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
===================================================================
@@ -0,0 +1,51 @@
+// { dg-options "-std=gnu++0x" }
+//
+// 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 <array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ {
+ bool test __attribute__((unused)) = true;
+
+ const size_t len = 5;
+ typedef std::array<int, len> array_type;
+ array_type a = { { 0, 1, 2, 3, 4 } };
+
+ VERIFY( a.empty() == false );
+ }
+
+ {
+ bool test __attribute__((unused)) = true;
+
+ const size_t len = 0;
+ typedef std::array<int, len> array_type;
+ array_type a;
+
+ VERIFY( a.empty() == true );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
===================================================================
@@ -0,0 +1,51 @@
+// { dg-options "-std=gnu++0x" }
+//
+// 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 <array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ {
+ bool test __attribute__((unused)) = true;
+
+ const size_t len = 5;
+ typedef std::array<int, len> array_type;
+ array_type a = { { 0, 1, 2, 3, 4 } };
+
+ VERIFY( a.max_size() == len );
+ }
+
+ {
+ bool test __attribute__((unused)) = true;
+
+ const size_t len = 0;
+ typedef std::array<int, len> array_type;
+ array_type a;
+
+ VERIFY( a.max_size() == len );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
===================================================================
@@ -0,0 +1,51 @@
+// { dg-options "-std=gnu++0x" }
+//
+// 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 <array>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ {
+ bool test __attribute__((unused)) = true;
+
+ const size_t len = 5;
+ typedef std::array<int, len> array_type;
+ array_type a = { { 0, 1, 2, 3, 4 } };
+
+ VERIFY( a.size() == len );
+ }
+
+ {
+ bool test __attribute__((unused)) = true;
+
+ const size_t len = 0;
+ typedef std::array<int, len> array_type;
+ array_type a;
+
+ VERIFY( a.size() == len );
+ }
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
===================================================================
@@ -2,7 +2,7 @@
// { dg-options "-std=gnu++0x" }
// { dg-require-cstdint "" }
-// Copyright (C) 2008, 2009 Free Software Foundation
+// Copyright (C) 2008, 2009, 2010, 2011 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
@@ -38,3 +38,7 @@
duration<int, std::milli> d2_copy(d2); // { dg-error "no matching|no type" }
}
+// { dg-prune-output "include" }
+
+// Discard a bogus warning showing up with -Wall.
+// { dg-prune-output "suggest parentheses around" }
===================================================================
@@ -34,12 +34,14 @@
{
{
typedef std::tuple<int, float> tuple_type;
- constexpr tuple_type p1 = std::make_tuple(22, 22.222);
+ constexpr tuple_type p1 __attribute__((unused))
+ = std::make_tuple(22, 22.222);
}
{
typedef std::tuple<int, float, int> tuple_type;
- constexpr tuple_type p1 = std::make_tuple(22, 22.222, 77799);
+ constexpr tuple_type p1 __attribute__((unused))
+ = std::make_tuple(22, 22.222, 77799);
}
}
@@ -50,13 +52,15 @@
{
typedef std::tuple<int, float> tuple_type;
constexpr tuple_type t1 { 55, 77.77 };
- constexpr auto var = std::get<1>(t1);
+ constexpr auto var __attribute__((unused))
+ = std::get<1>(t1);
}
{
typedef std::tuple<int, float, int> tuple_type;
constexpr tuple_type t1 { 55, 77.77, 99 };
- constexpr auto var = std::get<2>(t1);
+ constexpr auto var __attribute__((unused))
+ = std::get<2>(t1);
}
}
@@ -69,7 +73,7 @@
constexpr tuple_type1 t1 { 55, 77.77 };
constexpr tuple_type2 t2 { 55, 99, 77.77 };
- constexpr auto cat1 = std::tuple_cat(t1, t2);
+ constexpr auto cat1 __attribute__((unused)) = std::tuple_cat(t1, t2);
}
int
===================================================================
@@ -18,7 +18,6 @@
// 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 pair, and also vector. If the implementation
// changes this test may begin to fail.
@@ -31,7 +30,7 @@
{
bool test __attribute__((unused)) = true;
typedef std::pair<int, float> pair_type;
- constexpr pair_type p1 = std::make_pair(22, 22.222);
+ constexpr pair_type p1 __attribute__((unused)) = std::make_pair(22, 22.222);
}
int
===================================================================
@@ -35,11 +35,11 @@
constexpr duration<int> d0(12);
constexpr duration<int> d1(3);
- constexpr auto r1 = t1 + d0;
- constexpr auto r2 = d1 + t2;
+ constexpr auto r1 __attribute__((unused)) = t1 + d0;
+ constexpr auto r2 __attribute__((unused)) = d1 + t2;
- constexpr auto r3 = t1 - d0;
- constexpr auto r4 = t2 - t3;
+ constexpr auto r3 __attribute__((unused)) = t1 - d0;
+ constexpr auto r4 __attribute__((unused)) = t2 - t3;
return 0;
}
===================================================================
@@ -41,3 +41,5 @@
std::shared_ptr<A> sp1 = factory<A>(2, 1.414); // { dg-error "required from here" }
}
+// Discard a bogus warning showing up with -Wall.
+// { dg-prune-output "control reaches end of" }