[PATCH] Add tests and docs for LWG 2212 support
Jonathan Wakely
jwakely@redhat.com
Tue Jul 12 14:02:00 GMT 2016
* testsuite/20_util/pair/astuple/astuple.cc: Only include <utility>.
* testsuite/23_containers/array/tuple_interface/tuple_element.cc:
Only include <array>.
* testsuite/23_containers/array/tuple_interface/tuple_size.cc:
Likewise.
* doc/xml/manual/intro.xml; Document LWG 2212 support.
* doc/html*: Regenerate.
We already implement LWG 2212 but this tweaks the tests to verify it.
Tested x86_64-linux, committed to trunk.
-------------- next part --------------
commit 8c5a11cb7545d1a701596665392a8f4bf29a1489
Author: redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Tue Jul 12 14:00:26 2016 +0000
Add tests and docs for LWG 2212 support
* testsuite/20_util/pair/astuple/astuple.cc: Only include <utility>.
* testsuite/23_containers/array/tuple_interface/tuple_element.cc:
Only include <array>.
* testsuite/23_containers/array/tuple_interface/tuple_size.cc:
Likewise.
* doc/xml/manual/intro.xml; Document LWG 2212 support.
* doc/html*: Regenerate.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@238244 138bc75d-0d04-0410-961f-82ee72b054a4
diff --git a/libstdc++-v3/doc/xml/manual/intro.xml b/libstdc++-v3/doc/xml/manual/intro.xml
index 2aa9ba7..a47a3ec 100644
--- a/libstdc++-v3/doc/xml/manual/intro.xml
+++ b/libstdc++-v3/doc/xml/manual/intro.xml
@@ -934,6 +934,14 @@ requirements of the license of GCC.
<listitem><para>Use the referenceable type concept.
</para></listitem></varlistentry>
+ <varlistentry><term><link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="../ext/lwg-defects.html#2212">2212</link>:
+ <emphasis><code>tuple_size</code> for <code>const pair</code> request <code><tuple></code> header</emphasis>
+ </term>
+ <listitem><para>The <code>tuple_size</code> and <code>tuple_element</code>
+ partial specializations are defined in <code><utility></code> which
+ is included by <code><array></code>.
+ </para></listitem></varlistentry>
+
<varlistentry><term><link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="../ext/lwg-defects.html#2313">2313</link>:
<emphasis><code>tuple_size</code> should always derive from <code>integral_constant<size_t, N></code></emphasis>
</term>
diff --git a/libstdc++-v3/testsuite/20_util/pair/astuple/astuple.cc b/libstdc++-v3/testsuite/20_util/pair/astuple/astuple.cc
index 8b6fca3..3a458bb 100644
--- a/libstdc++-v3/testsuite/20_util/pair/astuple/astuple.cc
+++ b/libstdc++-v3/testsuite/20_util/pair/astuple/astuple.cc
@@ -18,8 +18,10 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
+// NB: Don't include any other headers in this file.
+// LWG 2212 requires <utility> to define tuple_size<cv T> and
+// tuple_element<cv T> specializations.
#include <utility>
-#include <type_traits>
typedef std::pair<int, long> test_type;
@@ -32,6 +34,7 @@ static_assert( std::tuple_size<const volatile test_type>::value == 2,
template<std::size_t N, typename T>
using Tuple_elt = typename std::tuple_element<N, T>::type;
+// This relies on the fact that <utility> includes <type_traits>:
using std::is_same;
static_assert( is_same<Tuple_elt<0, test_type>, test_type::first_type>::value,
diff --git a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element.cc b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element.cc
index 96e0bfb..65da753 100644
--- a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element.cc
+++ b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element.cc
@@ -18,15 +18,18 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
+// NB: Don't include any other headers in this file.
+// LWG 2212 requires <array> to define tuple_element<cv T> specializations.
#include <array>
-#include <type_traits>
-#include <testsuite_hooks.h>
void
test01()
{
bool test __attribute__((unused)) = true;
- using namespace std;
+ using std::array;
+ using std::tuple_element;
+ // This relies on the fact that <utility> includes <type_traits>:
+ using std::is_same;
const size_t len = 3;
typedef array<int, len> array_type;
diff --git a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_size.cc b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_size.cc
index 4a95fa7..6fe501e 100644
--- a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_size.cc
+++ b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_size.cc
@@ -18,14 +18,18 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
+// NB: Don't include any other headers in this file.
+// LWG 2212 requires <array> to define tuple_size<cv T> specializations.
#include <array>
-#include <testsuite_hooks.h>
void
test01()
{
bool test __attribute__((unused)) = true;
- using namespace std;
+ using std::array;
+ using std::tuple_size;
+ // This relies on the fact that <utility> includes <type_traits>:
+ using std::is_same;
{
const size_t len = 5;
More information about the Libstdc++
mailing list