https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83102
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- If we want to relax the check this should work: --- a/libstdc++-v3/include/bits/stl_tree.h +++ b/libstdc++-v3/include/bits/stl_tree.h @@ -448,8 +448,12 @@ _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&>{}, +#if __cplusplus >= 201703L + // LWG DR 2542: Missing const requirements for associative containers + static_assert(is_invocable_v<const _Compare&, const _Key&, const _Key&>, + "comparison object must be invocable with two arguments of key type"); +#elif __cplusplus >= 201103L + static_assert(__is_invocable<_Compare&, const _Key&, const _Key&>{}, "comparison object must be invocable with two arguments of key type"); #endif