[Bug c++/114242] Coroutine with lambda-coroutine and operator new does not compile

2024-03-08 Thread src at andyf dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114242

Andreas Fertig  changed:

   What|Removed |Added

 Resolution|--- |INVALID
 Status|UNCONFIRMED |RESOLVED

--- Comment #6 from Andreas Fertig  ---
The behavior of g++ is correct.

[Bug c++/114242] Coroutine with lambda-coroutine and operator new does not compile

2024-03-05 Thread src at andyf dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114242

--- Comment #5 from Andreas Fertig  ---
My latest conclusion is that my code is indeed invalid. In the case of the
lambda, I have a class type. http://eel.is/c++draft/dcl.fct.def.coroutine#4
says that in such a case, p1 is an lvalue of *this. If I modify my original
example, g++ and MSVC accept the code, but Clang now rejects it:

https://compiler-explorer.com/z/1hhxfYW1v

I will open an issue there and let them confirm. But I think we can close this
issue for g++.

[Bug c++/114242] Coroutine with lambda-coroutine and operator new does not compile

2024-03-05 Thread src at andyf dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114242

--- Comment #4 from Andreas Fertig  ---
Thanks for looking into the issue!

While CWG 2585 tweaks the wording, my reading is that the code should be valid
even with C++20.

Regardless of that, without the lambda, the code compiles and uses a custom
allocator. 

After playing with the test case, I could reduce it to having only a
coroutine-lambda with a promise_type that has a custom operator new:

https://compiler-explorer.com/z/W53nKsfxG

Sorry for not having that done initially!

I suspect this case wasn't implemented (because it isn't obvious?).

[Bug c++/114242] Coroutine with lambda-coroutine and operator new does not compile

2024-03-05 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114242

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||C++-coroutines,
   ||rejects-valid
  Alias||cwg2585
 Blocks||94404

--- Comment #3 from Andrew Pinski  ---
Yes it looks like GCC does not implement CWG 2585.
https://cplusplus.github.io/CWG/issues/2585.html


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94404
[Bug 94404] [meta-bug] C++ core issues

[Bug c++/114242] Coroutine with lambda-coroutine and operator new does not compile

2024-03-05 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114242

--- Comment #2 from Andrew Pinski  ---
Created attachment 57617
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57617=edit
testcase

[Bug c++/114242] Coroutine with lambda-coroutine and operator new does not compile

2024-03-05 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114242

--- Comment #1 from Andrew Pinski  ---
Note IIRC C++26 (maybe even 23) changed in this area over C++20 and GCC is
following (the initial?) C++20 rules.