public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114242] New: Coroutine with lambda-coroutine and operator new does not compile
@ 2024-03-05 15:42 src at andyf dot de
  2024-03-05 18:14 ` [Bug c++/114242] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: src at andyf dot de @ 2024-03-05 15:42 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-03-08 17:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-05 15:42 [Bug c++/114242] New: Coroutine with lambda-coroutine and operator new does not compile src at andyf dot de
2024-03-05 18:14 ` [Bug c++/114242] " pinskia at gcc dot gnu.org
2024-03-05 18:15 ` pinskia at gcc dot gnu.org
2024-03-05 18:20 ` pinskia at gcc dot gnu.org
2024-03-05 18:46 ` src at andyf dot de
2024-03-05 19:51 ` src at andyf dot de
2024-03-08 17:21 ` src at andyf dot de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).