https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114242
Bug ID: 114242 Summary: Coroutine with lambda-coroutine and operator new does not compile Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: src at andyf dot de Target Milestone: --- Hello, the following code is accepted by Clang but rejected by g++ and MSVC: https://compiler-explorer.com/z/7P548dGG3 Once the lambda inside the coroutine isn't used, the code compiles with all three compilers. My reading of http://eel.is/c++draft/dcl.fct.def.coroutine#9.1 is that the custom operator new should be picked in all cases. G++'s error: ``` <source>: In lambda function: <source>:54:15: error: 'operator new' is provided by 'std::__n4861::__coroutine_traits_impl<Generator, void>::promise_type' {aka 'Generator::promise_type'} but is not usable with the function signature 'coro(std::span<unsigned char>)::<lambda(std::span<unsigned char>)>' 54 | auto lamb = [](std::span<unsigned char>) -> Generator { | ^ ``` suggests that the compiler tries to look up an operator new with only size as an argument.