Repository navigation
[GNATS 26906] "Spurious diagnostic for no instance of overloaded ""boost::cobalt::detail::partial_promise_base<A llocator>::operator new [with Allocator=std::pmr::polymorphic_allocator<void>]""" #146
jhsedg
started this conversation in
Issue Triage - General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Customer bug ID
tests with Boost header /boost/cobalt/detail/wrapper.hpp, 26906.C, 26906a.C (reducded test)
Description
"../boost/cobalt/detail/wrapper.hpp", line 141: error #384: no instance of overloaded "boost::cobalt::detail::partial_promise_base<A
llocator>::operator new [with Allocator=std::pmr::polymorphic_allocator]" matches the argument list
argument types are: (unsigned long)
auto post_coroutine(Executor exec, CompletionToken token)
^
"../boost/cobalt/detail/wrapper.hpp", line 37: note #3322-D: number of parameters of function template "boost::cobalt::detail::parti
al_promise_base::operator new(std::size_t, Executor &, CompletionToken &) [with Allocator=std::pmr::polymorphic_allocator
]" does not match the call
void * operator new(const std::size_t size, Executor &, CompletionToken & token)
^
"../boost/cobalt/detail/wrapper.hpp", line 29: note #3322-D: number of parameters of function template "boost::cobalt::detail::parti
al_promise_base::operator new(std::size_t, CompletionToken &) [with Allocator=std::pmr::polymorphic_allocator]" doe
s not match the call
void * operator new(const std::size_t size, CompletionToken & token)
^
detected during instantiation of "auto boost::cobalt::detail::post_coroutine(Executor, CompletionToken)->std::__n4861::cor
outine_handle<boost::cobalt::detail::post_coroutine_promise<boost::asio::associated_allocator_t<CompletionToken, std::allocator<void
>>>> [with Executor=boost::asio::io_context::executor_type, CompletionToken=completion]" at line 38 of "../libs/cobalt/test/wrappers
.cpp"
The reduced test is:
namespace std {
template struct integral_constant {
static constexpr bool value = __v;
};
using true_type = integral_constant;
} // namespace std
namespace asio {
using std::true_type;
namespace execution {
template struct is_executor : true_type {};
template
concept executor = is_executor::value;
} // namespace execution
template struct associated_allocator_impl {
typedef T::allocator_type type;
};
template
using associated_allocator_t = associated_allocator_impl::type;
} // namespace asio
namespace std {
namespace pmr {
template struct polymorphic_allocator {
polymorphic_allocator(int *);
};
} // namespace pmr
} // namespace std
namespace boost::cobalt {
namespace pmr = std::pmr;
}
namespace std {
inline namespace {
template <typename...> struct coroutine_traits;
template <typename = void> struct coroutine_handle {
operator coroutine_handle<>() noexcept;
};
struct suspend_always {
bool await_ready();
void await_suspend(coroutine_handle<>);
void await_resume();
};
struct suspend_never {
bool await_ready() noexcept;
void await_suspend(coroutine_handle<>) noexcept;
void await_resume() noexcept;
};
} // namespace
} // namespace std
namespace boost::cobalt::detail {
template struct partial_promise_base {
template <typename Executor, typename CompletionToken>
void *operator new(unsigned long, Executor, CompletionToken &) {}
};
template
struct partial_promise : partial_promise_base {
auto initial_suspend() { return std::suspend_always(); }
auto final_suspend() noexcept { return std::suspend_never(); }
};
template
struct post_coroutine_promise : partial_promise {
template auto yield_value(CompletionToken) {
struct awaitable_t {
bool await_ready();
void await_suspend(std::coroutine_handle<>);
void await_resume();
};
return awaitable_t{};
}
void get_return_object();
void unhandled_exception();
};
} // namespace boost::cobalt::detail
namespace std {
template <typename T, typename... Args>
struct coroutine_traits<
coroutine_handle<boost::cobalt::detail::post_coroutine_promise>,
Args...> {
using promise_type = boost::cobalt::detail::post_coroutine_promise;
};
} // namespace std
namespace boost::cobalt::detail {
template <asio::execution::executor Executor, typename CompletionToken>
auto post_coroutine(Executor, CompletionToken token) -> std::coroutine_handle<
post_coroutine_promise<asio::associated_allocator_t>> {
co_yield token;
}
} // namespace boost::cobalt::detail
bool test_method_ran;
void test_method() {
int res;
struct completion {
bool ran;
using allocator_type = boost::cobalt::pmr::polymorphic_allocator;
boost::cobalt::pmr::polymorphic_allocator alloc;
};
boost::cobalt::detail::post_coroutine(0, completion{test_method_ran, &res});
}
cpfe -DTEST_NUMBER=1 --gnu_version=120100 --c++20 -tused --error_limit=1 -w Test_na
me.c
"Test_name.c", line 83: error: no instance of overloaded
"boost::cobalt::detail::partial_promise_base::operator new
[with Allocator=std::pmr::polymorphic_allocator]" matches the
argument list
argument types are: (unsigned long)
auto post_coroutine(Executor, CompletionToken token) -> std::coroutine_handle<
^
"Test_name.c", line 52: note: number of parameters of function template
"boost::cobalt::detail::partial_promise_base::operator new
[with Allocator=std::pmr::polymorphic_allocator]" does not
match the call
void *operator new(unsigned long, Executor, CompletionToken &) {}
^
detected during instantiation of "auto
boost::cobalt::detail::post_coroutine(Executor,
CompletionToken)->std::::coroutine_handle<boost::c
obalt::detail::post_coroutine_promise<asio::associated_allo
cator_t>> [with Executor=int,
CompletionToken=completion]" at line 96
Error limit reached.
1 error detected in the compilation of "Test_name.c".
Compilation terminated.
Notes
ellen, 2024-01-02:
A reduced test was added.
All reactions