[libcxx-commits] [libcxx] 920c0f7 - [libcxx] adds __cpp_lib_concepts feature-test macro

Christopher Di Bella via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 7 09:15:39 PDT 2021


Author: Christopher Di Bella
Date: 2021-04-07T16:14:45Z
New Revision: 920c0f7e09e2a55a800a181fb9bfe296a8733c89

URL: https://github.com/llvm/llvm-project/commit/920c0f7e09e2a55a800a181fb9bfe296a8733c89
DIFF: https://github.com/llvm/llvm-project/commit/920c0f7e09e2a55a800a181fb9bfe296a8733c89.diff

LOG: [libcxx] adds __cpp_lib_concepts feature-test macro

Also adjusts C++20 status paper to indicate full concepts support.

Depends on D96477, D99817.

Differential Revision: https://reviews.llvm.org/D99805

Added: 
    

Modified: 
    libcxx/docs/Cxx2aStatusIssuesStatus.csv
    libcxx/docs/Cxx2aStatusPaperStatus.csv
    libcxx/docs/FeatureTestMacroTable.rst
    libcxx/include/concepts
    libcxx/include/version
    libcxx/test/std/language.support/support.limits/support.limits.general/concepts.version.pass.cpp
    libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
    libcxx/utils/generate_feature_test_macro_components.py

Removed: 
    


################################################################################
diff  --git a/libcxx/docs/Cxx2aStatusIssuesStatus.csv b/libcxx/docs/Cxx2aStatusIssuesStatus.csv
index 55d5126ab2930..3967999a65dd2 100644
--- a/libcxx/docs/Cxx2aStatusIssuesStatus.csv
+++ b/libcxx/docs/Cxx2aStatusIssuesStatus.csv
@@ -192,10 +192,10 @@
 "`2859 <https://wg21.link/LWG2859>`__","Definition of *reachable* in [ptr.launder] misses pointer arithmetic from pointer-interconvertible object","Prague","",""
 "`3018 <https://wg21.link/LWG3018>`__","``shared_ptr``\  of function type","Prague","",""
 "`3050 <https://wg21.link/LWG3050>`__","Conversion specification problem in ``chrono::duration``\  constructor","Prague","",""
-"`3141 <https://wg21.link/LWG3141>`__","``CopyConstructible``\  doesn't preserve source values","Prague","",""
-"`3150 <https://wg21.link/LWG3150>`__","``UniformRandomBitGenerator``\  should validate ``min``\  and ``max``\ ","Prague","",""
+"`3141 <https://wg21.link/LWG3141>`__","``CopyConstructible``\  doesn't preserve source values","Prague","|Nothing to do|",""
+"`3150 <https://wg21.link/LWG3150>`__","``UniformRandomBitGenerator``\  should validate ``min``\  and ``max``\ ","Prague","|Complete|","13.0"
 "`3175 <https://wg21.link/LWG3175>`__","The ``CommonReference``\  requirement of concept ``SwappableWith``\  is not satisfied in the example","Prague","|Complete|","13.0"
-"`3194 <https://wg21.link/LWG3194>`__","``ConvertibleTo``\  prose does not match code","Prague","",""
+"`3194 <https://wg21.link/LWG3194>`__","``ConvertibleTo``\  prose does not match code","Prague","|Complete|","13.0"
 "`3200 <https://wg21.link/LWG3200>`__","``midpoint``\  should not constrain ``T``\  is complete","Prague","|Nothing To Do|",""
 "`3201 <https://wg21.link/LWG3201>`__","``lerp``\  should be marked as ``noexcept``\ ","Prague","|Complete|",""
 "`3226 <https://wg21.link/LWG3226>`__","``zoned_time``\  constructor from ``string_view``\  should accept ``zoned_time<Duration2, TimeZonePtr2>``\ ","Prague","",""
@@ -249,13 +249,13 @@
 "`3326 <https://wg21.link/LWG3326>`__","``enable_view``\  has false positives","Prague","",""
 "`3327 <https://wg21.link/LWG3327>`__","Format alignment specifiers vs. text direction","Prague","",""
 "`3328 <https://wg21.link/LWG3328>`__","Clarify that ``std::string``\  is not good for UTF-8","Prague","",""
-"`3329 <https://wg21.link/LWG3329>`__","``totally_ordered_with``\  both directly and indirectly requires ``common_reference_with``\ ","Prague","",""
+"`3329 <https://wg21.link/LWG3329>`__","``totally_ordered_with``\  both directly and indirectly requires ``common_reference_with``\ ","Prague","|Complete|","13.0"
 "`3330 <https://wg21.link/LWG3330>`__","Include ``<compare>``\  from most library headers","Prague","",""
-"`3331 <https://wg21.link/LWG3331>`__","Define ``totally_ordered/_with``\  in terms of ``*partially-ordered-with*``\ ","Prague","",""
+"`3331 <https://wg21.link/LWG3331>`__","Define ``totally_ordered/_with``\  in terms of ``*partially-ordered-with*``\ ","Prague","|Complete|","13.0"
 "`3332 <https://wg21.link/LWG3332>`__","Issue in |sect|\ [time.format]","Prague","",""
 "`3334 <https://wg21.link/LWG3334>`__","``basic_osyncstream``\  move assignment and destruction calls ``basic_syncbuf::emit()``\  twice","Prague","",""
 "`3335 <https://wg21.link/LWG3335>`__","Resolve C++20 NB comments US 273 and GB 274","Prague","",""
-"`3338 <https://wg21.link/LWG3338>`__","Rename ``default_constructible``\  to ``default_initializable``\ ","Prague","",""
+"`3338 <https://wg21.link/LWG3338>`__","Rename ``default_constructible``\  to ``default_initializable``\ ","Prague","|Complete|","13.0"
 "`3340 <https://wg21.link/LWG3340>`__","Formatting functions should throw on argument/format string mismatch in |sect|\ [format.functions]","Prague","",""
 "`3346 <https://wg21.link/LWG3346>`__","``pair``\  and ``tuple``\  copy and move constructor have backwards specification","Prague","",""
 "`3347 <https://wg21.link/LWG3347>`__","``std::pair<T, U>``\  now requires ``T``\  and ``U``\  to be less-than-comparable","Prague","",""

diff  --git a/libcxx/docs/Cxx2aStatusPaperStatus.csv b/libcxx/docs/Cxx2aStatusPaperStatus.csv
index 8ff62a5387fe4..696a16c09c191 100644
--- a/libcxx/docs/Cxx2aStatusPaperStatus.csv
+++ b/libcxx/docs/Cxx2aStatusPaperStatus.csv
@@ -43,7 +43,7 @@
 "`P0879R0 <https://wg21.link/P0879R0>`__","LWG","Constexpr for swap and swap related functions Also resolves LWG issue 2800.","Rapperswil","|Complete|","13.0"
 "`P0887R1 <https://wg21.link/P0887R1>`__","LWG","The identity metafunction","Rapperswil","|Complete|","8.0"
 "`P0892R2 <https://wg21.link/P0892R2>`__","CWG","explicit(bool)","Rapperswil","",""
-"`P0898R3 <https://wg21.link/P0898R3>`__","LWG","Standard Library Concepts","Rapperswil","|In Progress|",""
+"`P0898R3 <https://wg21.link/P0898R3>`__","LWG","Standard Library Concepts","Rapperswil","|Complete|","13.0"
 "`P0935R0 <https://wg21.link/P0935R0>`__","LWG","Eradicating unnecessarily explicit default constructors from the standard library","Rapperswil","|Complete|","12.0"
 "`P0941R2 <https://wg21.link/P0941R2>`__","CWG","Integrating feature-test macros into the C++ WD","Rapperswil","|In Progress|",""
 "`P1023R0 <https://wg21.link/P1023R0>`__","LWG","constexpr comparison operators for std::array","Rapperswil","|Complete|","8.0"
@@ -177,7 +177,7 @@
 "`P1956 <https://wg21.link/P1956>`__","LWG","On the names of low-level bit manipulation functions","Prague","|Complete|","12.0"
 "`P1957 <https://wg21.link/P1957>`__","CWG","Converting from ``T*``\  to bool should be considered narrowing (re: US 212)","Prague","* *",""
 "`P1963 <https://wg21.link/P1963>`__","LWG","Fixing US 313","Prague","* *",""
-"`P1964 <https://wg21.link/P1964>`__","LWG","Wording for boolean-testable","Prague","* *",""
+"`P1964 <https://wg21.link/P1964>`__","LWG","Wording for boolean-testable","Prague","|Complete|","13.0"
 "`P1970 <https://wg21.link/P1970>`__","LWG","Consistency for size() functions: Add ranges::ssize","Prague","* *",""
 "`P1973 <https://wg21.link/P1973>`__","LWG","Rename ""_default_init"" Functions, Rev1","Prague","* *",""
 "`P1976 <https://wg21.link/P1976>`__","LWG","Fixed-size span construction from dynamic range","Prague","|Complete|","11.0"

diff  --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst
index 806b30f22d74f..8c4f2a892c3e5 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -198,7 +198,7 @@ Status
     ------------------------------------------------- -----------------
     ``__cpp_lib_char8_t``                             ``201811L``
     ------------------------------------------------- -----------------
-    ``__cpp_lib_concepts``                            *unimplemented*
+    ``__cpp_lib_concepts``                            ``202002L``
     ------------------------------------------------- -----------------
     ``__cpp_lib_constexpr_algorithms``                ``201806L``
     ------------------------------------------------- -----------------

diff  --git a/libcxx/include/concepts b/libcxx/include/concepts
index 6ce2fad1426b9..7127f289b7932 100644
--- a/libcxx/include/concepts
+++ b/libcxx/include/concepts
@@ -67,9 +67,9 @@ namespace std {
   template<class T, class... Args>
     concept constructible_from = see below;
 
-  // [concept.defaultconstructible], concept default_constructible
+  // [concept.default.init], concept default_initializable
   template<class T>
-    concept default_constructible = see below;
+    concept default_initializable = see below;
 
   // [concept.moveconstructible], concept move_constructible
   template<class T>
@@ -79,11 +79,6 @@ namespace std {
   template<class T>
     concept copy_constructible = see below;
 
-  // [concepts.compare], comparison concepts
-  // [concept.boolean], concept boolean
-  template<class B>
-    concept boolean = see below;
-
   // [concept.equalitycomparable], concept equality_comparable
   template<class T>
     concept equality_comparable = see below;

diff  --git a/libcxx/include/version b/libcxx/include/version
index 7ff5f914d76ca..9de078a39b9f8 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -298,7 +298,7 @@ __cpp_lib_void_t                                        201411L <type_traits>
 # if !defined(_LIBCPP_NO_HAS_CHAR8_T)
 #   define __cpp_lib_char8_t                            201811L
 # endif
-// # define __cpp_lib_concepts                             202002L
+# define __cpp_lib_concepts                             202002L
 # define __cpp_lib_constexpr_algorithms                 201806L
 // # define __cpp_lib_constexpr_complex                    201711L
 # define __cpp_lib_constexpr_dynamic_alloc              201907L

diff  --git a/libcxx/test/std/language.support/support.limits/support.limits.general/concepts.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/concepts.version.pass.cpp
index 4ca51bdd8c34f..c6a61ac4f9522 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/concepts.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/concepts.version.pass.cpp
@@ -42,32 +42,20 @@
 
 #elif TEST_STD_VER == 20
 
-# if !defined(_LIBCPP_VERSION)
-#   ifndef __cpp_lib_concepts
-#     error "__cpp_lib_concepts should be defined in c++20"
-#   endif
-#   if __cpp_lib_concepts != 202002L
-#     error "__cpp_lib_concepts should have the value 202002L in c++20"
-#   endif
-# else // _LIBCPP_VERSION
-#   ifdef __cpp_lib_concepts
-#     error "__cpp_lib_concepts should not be defined because it is unimplemented in libc++!"
-#   endif
+# ifndef __cpp_lib_concepts
+#   error "__cpp_lib_concepts should be defined in c++20"
+# endif
+# if __cpp_lib_concepts != 202002L
+#   error "__cpp_lib_concepts should have the value 202002L in c++20"
 # endif
 
 #elif TEST_STD_VER > 20
 
-# if !defined(_LIBCPP_VERSION)
-#   ifndef __cpp_lib_concepts
-#     error "__cpp_lib_concepts should be defined in c++2b"
-#   endif
-#   if __cpp_lib_concepts != 202002L
-#     error "__cpp_lib_concepts should have the value 202002L in c++2b"
-#   endif
-# else // _LIBCPP_VERSION
-#   ifdef __cpp_lib_concepts
-#     error "__cpp_lib_concepts should not be defined because it is unimplemented in libc++!"
-#   endif
+# ifndef __cpp_lib_concepts
+#   error "__cpp_lib_concepts should be defined in c++2b"
+# endif
+# if __cpp_lib_concepts != 202002L
+#   error "__cpp_lib_concepts should have the value 202002L in c++2b"
 # endif
 
 #endif // TEST_STD_VER > 20

diff  --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
index 593d63d3406cb..f83917f86f894 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.pass.cpp
@@ -2389,17 +2389,11 @@
 #   error "__cpp_lib_complex_udls should have the value 201309L in c++20"
 # endif
 
-# if !defined(_LIBCPP_VERSION)
-#   ifndef __cpp_lib_concepts
-#     error "__cpp_lib_concepts should be defined in c++20"
-#   endif
-#   if __cpp_lib_concepts != 202002L
-#     error "__cpp_lib_concepts should have the value 202002L in c++20"
-#   endif
-# else // _LIBCPP_VERSION
-#   ifdef __cpp_lib_concepts
-#     error "__cpp_lib_concepts should not be defined because it is unimplemented in libc++!"
-#   endif
+# ifndef __cpp_lib_concepts
+#   error "__cpp_lib_concepts should be defined in c++20"
+# endif
+# if __cpp_lib_concepts != 202002L
+#   error "__cpp_lib_concepts should have the value 202002L in c++20"
 # endif
 
 # ifndef __cpp_lib_constexpr_algorithms
@@ -3576,17 +3570,11 @@
 #   error "__cpp_lib_complex_udls should have the value 201309L in c++2b"
 # endif
 
-# if !defined(_LIBCPP_VERSION)
-#   ifndef __cpp_lib_concepts
-#     error "__cpp_lib_concepts should be defined in c++2b"
-#   endif
-#   if __cpp_lib_concepts != 202002L
-#     error "__cpp_lib_concepts should have the value 202002L in c++2b"
-#   endif
-# else // _LIBCPP_VERSION
-#   ifdef __cpp_lib_concepts
-#     error "__cpp_lib_concepts should not be defined because it is unimplemented in libc++!"
-#   endif
+# ifndef __cpp_lib_concepts
+#   error "__cpp_lib_concepts should be defined in c++2b"
+# endif
+# if __cpp_lib_concepts != 202002L
+#   error "__cpp_lib_concepts should have the value 202002L in c++2b"
 # endif
 
 # ifndef __cpp_lib_constexpr_algorithms

diff  --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py
index 3dec6d992c3e3..02f9e00972ce4 100755
--- a/libcxx/utils/generate_feature_test_macro_components.py
+++ b/libcxx/utils/generate_feature_test_macro_components.py
@@ -208,7 +208,6 @@ def add_version_header(tc):
     "name": "__cpp_lib_concepts",
     "values": { "c++20": 202002 },
     "headers": ["concepts"],
-    "unimplemented": True,
   }, {
     "name": "__cpp_lib_constexpr_algorithms",
     "values": { "c++20": 201806 },


        


More information about the libcxx-commits mailing list