author: Andres Salomon Work around the following: In file included from ../../mojo/public/cpp/bindings/lib/native_s:32 truct_serialization.cc:5: In file included from ../../mojo/public/cpp/bindings/lib/native_struct_serialization.h:13: In file included from ../../base/check_op.h:9: In file included from /usr/bin/../include/c++/v1/string:545: In file included from /usr/bin/../include/c++/v1/__functional/hash.h:24: In file included from /usr/bin/../include/c++/v1/__utility/pair.h:16: In file included from /usr/bin/../include/c++/v1/__fwd/get.h:16: In file included from /usr/bin/../include/c++/v1/__fwd/subrange.h:20: In file included from /usr/bin/../include/c++/v1/__iterator/concepts.h:34: /usr/bin/../include/c++/v1/__memory/pointer_traits.h:118:22: error: implicit instantiation of undefined template 'std::__pointer_traits_element_type' typedef typename __pointer_traits_element_type::type element_type; ^ ../../base/types/to_address.h:32:40: note: in instantiation of template class 'std::pointer_traits' requested here requires requires(const P& p) { std::pointer_traits

::to_address(p); } || ^ ../../base/types/to_address.h:32:35: note: in instantiation of requirement here ../../mojo/public/cpp/bindings/lib/native_struct_serialization.cc requires requires(const P& p) { std::pointer_traits

::to_address(p); } || ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../base/types/to_address.h:32:12: note: while substituting template arguments into constraint expression here requires requires(const P& p) { std::pointer_traits

::to_address(p); } || ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../mojo/public/cpp/bindings/type_converter.h:103:26: note: while checking constraint satisfaction for template 'to_address' required here { mojo::ConvertTo(base::to_address(obj)) } -> std::same_as; ^~~~ This turns out to be a clang-16 bug, fixed in clang-18: https://github.com/llvm/llvm-project/issues/67449 This is just the pointer_traits.h header from libc++-18-dev, with a minor tweak to get things building. --- /dev/null +++ b/__memory/pointer_traits.h @@ -0,0 +1,245 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___MEMORY_POINTER_TRAITS_H +#define _LIBCPP___MEMORY_POINTER_TRAITS_H + +#include <__config> +#include <__memory/addressof.h> +#include <__type_traits/conditional.h> +#include <__type_traits/conjunction.h> +#include <__type_traits/decay.h> +#include <__type_traits/is_class.h> +#include <__type_traits/is_function.h> +#include <__type_traits/is_void.h> +#include <__type_traits/void_t.h> +#include <__utility/declval.h> +#include + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template +struct __has_element_type : false_type {}; + +template +struct __has_element_type<_Tp, __void_t > : true_type {}; + +template ::value> +struct __pointer_traits_element_type {}; + +template +struct __pointer_traits_element_type<_Ptr, true> { + typedef _LIBCPP_NODEBUG typename _Ptr::element_type type; +}; + +template