PR go/83102 relax std::set checks for invocable comparison object
authorJonathan Wakely <jwakely@redhat.com>
Wed, 22 Nov 2017 11:06:15 +0000 (11:06 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 22 Nov 2017 11:06:15 +0000 (11:06 +0000)
PR go/83102
* include/bits/stl_tree.h (_Rb_tree): Relax invocable checks for
comparison object pre-C++17.

From-SVN: r255052

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/stl_tree.h

index c2f870a17704a76c51342dafd50a6b22fcca48a1..c17581b331447e6776c36c4b507f8ea7a80073b1 100644 (file)
@@ -1,3 +1,9 @@
+2017-11-22  Jonathan Wakely  <jwakely@redhat.com>
+
+       PR go/83102
+       * include/bits/stl_tree.h (_Rb_tree): Relax invocable checks for
+       comparison object pre-C++17.
+
 2017-11-21  Jonathan Wakely  <jwakely@redhat.com>
 
        PR libstdc++/48101
index ff36618bccfc13ca0f511289243e9718122f4402..df92a60d4dd81ecf9c8c029bdc78df01d983488c 100644 (file)
@@ -449,9 +449,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       typedef __gnu_cxx::__alloc_traits<_Node_allocator> _Alloc_traits;
 
 #if __cplusplus >= 201103L
-      static_assert(__is_invocable<const _Compare&, const _Key&, const _Key&>{},
+      static_assert(__is_invocable<_Compare&, const _Key&, const _Key&>{},
          "comparison object must be invocable with two arguments of key type");
-#endif
+# if __cplusplus >= 201703L
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // 2542. Missing const requirements for associative containers
+      static_assert(is_invocable_v<const _Compare&, const _Key&, const _Key&>,
+         "comparison object must be invocable as const");
+# endif // C++17
+#endif // C++11
 
     protected:
       typedef _Rb_tree_node_base*              _Base_ptr;