https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95457
Arsen Arsenović <arsen at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |arsen at gcc dot gnu.org --- Comment #1 from Arsen Arsenović <arsen at gcc dot gnu.org> --- hm, the promise itself is not constrained, the traits specialization is. I imagine that might be why the diagnostic fails to manifest. convoluting the template a bit to make it so that there is a constraint failure on the promise itself results in a diagnostic: template <typename... Args> class coroutine_traits<dummy_coroutine, Args...> { public: template<typename> requires (... && !rvalue_reference<Args>) struct my_promise { void return_value(int x) { } std::suspend_never initial_suspend() { return {}; } std::suspend_never final_suspend() noexcept { return {}; } dummy_coroutine get_return_object() { return {}; } void unhandled_exception() {} }; using promise_type = my_promise<void>; }; result: <source>: In instantiation of 'struct std::__n4861::coroutine_traits<dummy_coroutine, int&&>': <source>:36:15: required from here 36 | co_return x; | ^ <source>:26:11: error: template constraint failure for 'template<class ... Args> template<class> requires (... &&!(rvalue_reference<Args>)) struct std::__n4861::coroutine_traits<dummy_coroutine, Args ...>::my_promise' 26 | using promise_type = my_promise<void>; | ^~~~~~~~~~~~ <source>:26:11: note: constraints not satisfied <source>: In substitution of 'template<class ... Args> template<class> requires (... &&!(rvalue_reference<Args>)) struct std::__n4861::coroutine_traits<dummy_coroutine, Args ...>::my_promise [with <template-parameter-2-1> = void; Args = {int&&}]': <source>:26:11: required from 'struct std::__n4861::coroutine_traits<dummy_coroutine, int&&>' <source>:36:15: required from here 36 | co_return x; | ^ <source>:19:12: required by the constraints of 'template<class ... Args> template<class> requires (... &&!(rvalue_reference<Args>)) struct std::__n4861::coroutine_traits<dummy_coroutine, Args ...>::my_promise' <source>:18:19: note: the expression '(... &&!(rvalue_reference<Args>)) [with Args = {int&&}]' evaluated to 'false' 18 | requires (... && !rvalue_reference<Args>) | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ <source>: In function 'dummy_coroutine foo(int&&)': <source>:36:5: error: unable to find the promise type for this coroutine 36 | co_return x; | ^~~~~~~~~ Compiler returned: 1 unsure if this is solvable