This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Add std::bool_constant for C++17


This implements
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4389.html
which was voted into the working paper in Lenexa. Like the last patch,
this has a TODO placeholder for the feature-test macro.

It also updates the manual to document the status of all the library
papers from Lenexa.

Tested powerpc64le-linux, committed to trunk.

commit 3403af1ca5120ffb33d9aff076026ddf8cc01626
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Jun 5 17:54:11 2015 +0100

    	* doc/xml/manual/status_cxx2017.xml: Update status tables.
    	* doc/html/manual/*: Regenerate.
    	* include/std/type_traits (bool_constant): Define.
    	* testsuite/20_util/bool_constant/requirements.cc: New.
    	* testsuite/20_util/declval/requirements/1_neg.cc: Adjust dg-error.
    	* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
    	Likewise.
    	* testsuite/20_util/make_signed/requirements/typedefs_neg.cc:
    	Likewise.

diff --git a/libstdc++-v3/doc/xml/manual/status_cxx2017.xml b/libstdc++-v3/doc/xml/manual/status_cxx2017.xml
index 55f3cd2..d110572 100644
--- a/libstdc++-v3/doc/xml/manual/status_cxx2017.xml
+++ b/libstdc++-v3/doc/xml/manual/status_cxx2017.xml
@@ -162,6 +162,67 @@ not in any particular release.
       <entry/>
     </row>
 
+    <row>
+      <?dbhtml bgcolor="#C8B0B0" ?>
+      <entry>
+	<link xmlns:xlink="http://www.w3.org/1999/xlink"; xlink:href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4366.html";>
+	  N4387
+	</link>
+      </entry>
+      <entry>
+        LWG 2228: Missing SFINAE rule in unique_ptr templated assignment
+      </entry>
+      <entry>N</entry>
+      <entry/>
+    </row>
+
+    <row>
+      <?dbhtml bgcolor="#C8B0B0" ?>
+      <entry>
+	<link xmlns:xlink="http://www.w3.org/1999/xlink"; xlink:href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4387.html";>
+	  N4387
+	</link>
+      </entry>
+      <entry> Improving pair and tuple, revision 3 </entry>
+      <entry>N</entry>
+      <entry/>
+    </row>
+
+    <row>
+      <entry>
+	<link xmlns:xlink="http://www.w3.org/1999/xlink"; xlink:href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4389.html";>
+	  N4389
+	</link>
+      </entry>
+      <entry> Wording for bool_constant, revision 1 </entry>
+      <entry>Y</entry>
+      <entry/>
+    </row>
+
+    <row>
+      <entry>
+	<link xmlns:xlink="http://www.w3.org/1999/xlink"; xlink:href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4508.html";>
+	  N4508
+	</link>
+      </entry>
+      <entry>A proposal to add shared_mutex (untimed) (Revision 4)</entry>
+      <entry>Y</entry>
+      <entry/>
+    </row>
+
+    <row>
+      <entry>
+	<link xmlns:xlink="http://www.w3.org/1999/xlink"; xlink:href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4510.html";>
+	  N4510
+	</link>
+      </entry>
+      <entry>
+        Minimal incomplete type support for standard containers, revision 4
+      </entry>
+      <entry>Y</entry>
+      <entry/>
+    </row>
+
   </tbody>
 </tgroup>
 </table>
@@ -241,6 +302,69 @@ not in any particular release.
       <entry>Library Fundamentals 2 TS</entry>
     </row>
 
+
+    <row>
+      <?dbhtml bgcolor="#C8B0B0" ?>
+      <entry>
+	<link xmlns:xlink="http://www.w3.org/1999/xlink"; xlink:href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4388.html";>
+	  N4388
+	</link>
+      </entry>
+      <entry>Const-Propagating Wrapper</entry>
+      <entry>N</entry>
+      <entry>Library Fundamentals 2 TS</entry>
+    </row>
+
+    <row>
+      <?dbhtml bgcolor="#C8B0B0" ?>
+      <entry>
+	<link xmlns:xlink="http://www.w3.org/1999/xlink"; xlink:href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4391.html";>
+	  N4391
+	</link>
+      </entry>
+      <entry> <code>make_array</code>, revision 4 </entry>
+      <entry>N</entry>
+      <entry>Library Fundamentals 2 TS</entry>
+    </row>
+
+    <row>
+      <?dbhtml bgcolor="#C8B0B0" ?>
+      <entry>
+	<link xmlns:xlink="http://www.w3.org/1999/xlink"; xlink:href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4502.pdf";>
+	  N4502
+	</link>
+      </entry>
+      <entry> Support for the C++ Detection Idiom, V2 </entry>
+      <entry>N</entry>
+      <entry>Library Fundamentals 2 TS</entry>
+    </row>
+
+    <row>
+      <?dbhtml bgcolor="#C8B0B0" ?>
+      <entry>
+	<link xmlns:xlink="http://www.w3.org/1999/xlink"; xlink:href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4519.pdf";>
+	  N4519
+	</link>
+      </entry>
+      <entry> Source-Code Information Capture </entry>
+      <entry>N</entry>
+      <entry>Library Fundamentals 2 TS</entry>
+    </row>
+
+    <row>
+      <?dbhtml bgcolor="#C8B0B0" ?>
+      <entry>
+	<link xmlns:xlink="http://www.w3.org/1999/xlink"; xlink:href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4521.html";>
+	  N4521
+	</link>
+      </entry>
+      <entry> Merge Fundamentals V1 into V2 </entry>
+      <entry>N</entry>
+      <entry>Library Fundamentals 2 TS</entry>
+    </row>
+
+
+
   </tbody>
 </tgroup>
 </table>
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 2eae61b..e09c856 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -92,6 +92,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   template<bool __v>
     using __bool_constant = integral_constant<bool, __v>;
 
+#if __cplusplus > 201402L
+// TODO: #define __cpp_lib_bool_constant 201505
+  template<bool __v>
+    using bool_constant = integral_constant<bool, __v>;
+#endif
+
   // Meta programming helper types.
 
   template<bool, typename, typename>
diff --git a/libstdc++-v3/testsuite/20_util/bool_constant/requirements.cc b/libstdc++-v3/testsuite/20_util/bool_constant/requirements.cc
new file mode 100644
index 0000000..ddc02df
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/bool_constant/requirements.cc
@@ -0,0 +1,26 @@
+// Copyright (C) 2015 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++17" }
+// { dg-do compile }
+
+#include <type_traits>
+
+static_assert( std::is_same<std::bool_constant<true>, std::true_type>::value,
+    "bool_constant<true> is true_type");
+static_assert( std::is_same<std::bool_constant<false>, std::false_type>::value,
+    "bool_constant<false> is false_type");
diff --git a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
index 263fff2..2723e5c 100644
--- a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc
@@ -19,7 +19,7 @@
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
-// { dg-error "static assertion failed" "" { target *-*-* } 2203 }
+// { dg-error "static assertion failed" "" { target *-*-* } 2209 }
 
 #include <utility>
 
diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
index 5fbf311..507930d 100644
--- a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
@@ -48,4 +48,4 @@ void test01()
 // { dg-error "required from here" "" { target *-*-* } 40 }
 // { dg-error "required from here" "" { target *-*-* } 42 }
 
-// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1868 }
+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1874 }
diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
index 4e54b18..608fd1a 100644
--- a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
@@ -48,5 +48,5 @@ void test01()
 // { dg-error "required from here" "" { target *-*-* } 40 }
 // { dg-error "required from here" "" { target *-*-* } 42 }
 
-// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1764 }
-// { dg-error "declaration of" "" { target *-*-* } 1721 }
+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1770 }
+// { dg-error "declaration of" "" { target *-*-* } 1727 }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]