[Bug c++/121068] Placement new of array element is rejected at compile-time

2025-08-21 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121068 --- Comment #21 from GCC Commits --- The trunk branch has been updated by Jason Merrill : https://gcc.gnu.org/g:70f33ad677e6350a724b56d4cb766480ed8367fc commit r16--g70f33ad677e6350a724b56d4cb766480ed8367fc Author: Jason Merrill Date: T

[Bug c++/121068] Placement new of array element is rejected at compile-time

2025-08-21 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121068 Jason Merrill changed: What|Removed |Added Status|NEW |ASSIGNED --- Comment #20 from Jason Mer

[Bug c++/121068] Placement new of array element is rejected at compile-time

2025-08-21 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121068 --- Comment #19 from Jonathan Wakely --- I'm seeing a new libstdc++ testsuite failure since r16-3022-gbc42128330c0ea FAIL: 20_util/variant/102912.cc -std=gnu++20 (test for excess errors) FAIL: 20_util/variant/102912.cc -std=gnu++23 (test for

[Bug c++/121068] Placement new of array element is rejected at compile-time

2025-08-05 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121068 --- Comment #18 from GCC Commits --- The trunk branch has been updated by Jason Merrill : https://gcc.gnu.org/g:bc42128330c0ea70a015b74b655cb8c48b6a8c06 commit r16-3022-gbc42128330c0ea70a015b74b655cb8c48b6a8c06 Author: Jason Merrill Date: T

[Bug c++/121068] Placement new of array element is rejected at compile-time

2025-07-25 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121068 --- Comment #17 from Jason Merrill --- OK, the issue is that we currently don't represent trivial initialization at all, so the initial placement new has no effect. Then the trivial destructors are represented by clobbers, but constant evaluati

[Bug c++/121068] Placement new of array element is rejected at compile-time

2025-07-25 Thread tkaminsk at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121068 --- Comment #16 from Tomasz Kamiński --- Ah sorry, I was sure I posted the function before: ``` #include struct S { constexpr S() = default; constexpr S(int x) : s(x) {} constexpr S(S&& x) : s(x.s) {}

[Bug c++/121068] Placement new of array element is rejected at compile-time

2025-07-25 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121068 --- Comment #15 from Jason Merrill --- (In reply to Tomasz Kamiński from comment #14) Please provide complete testcases, this snippet isn't enough to reproduce.

[Bug c++/121068] Placement new of array element is rejected at compile-time

2025-07-23 Thread tkaminsk at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121068 --- Comment #14 from Tomasz Kamiński --- Not sure if this is expected, so noting this here. On trunk (with r16-2432-gfdbc5ff61b471076cc9c758fb6c30d62f7ef1c56), if I value initialize the array (like in inplace_vector), then the code works: uni

[Bug c++/121068] Placement new of array element is rejected at compile-time

2025-07-22 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121068 Jason Merrill changed: What|Removed |Added Attachment #61891|0 |1 is obsolete|

[Bug c++/121068] Placement new of array element is rejected at compile-time

2025-07-22 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121068 --- Comment #12 from GCC Commits --- The trunk branch has been updated by Jason Merrill : https://gcc.gnu.org/g:fdbc5ff61b471076cc9c758fb6c30d62f7ef1c56 commit r16-2432-gfdbc5ff61b471076cc9c758fb6c30d62f7ef1c56 Author: Jason Merrill Date: W

[Bug c++/121068] Placement new of array element is rejected at compile-time

2025-07-22 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121068 --- Comment #11 from Jason Merrill --- (In reply to Tomasz Kamiński from comment #9) > I remember that LWG3436 was discussed in core in Varna > (https://wiki.edg.com/bin/view/Wg21varna/CoreWorkingGroup#LWG3436) and the > current wording is resul

[Bug c++/121068] Placement new of array element is rejected at compile-time

2025-07-22 Thread tkaminsk at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121068 --- Comment #10 from Tomasz Kamiński --- If the object pointed by __location is not transparently replaceable, for example if I would create an object inside std::byte array that is an member, then does std::launder(__location) produce pointer t

[Bug c++/121068] Placement new of array element is rejected at compile-time

2025-07-22 Thread tkaminsk at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121068 --- Comment #9 from Tomasz Kamiński --- I remember that LWG3436 was discussed in core in Varna (https://wiki.edg.com/bin/view/Wg21varna/CoreWorkingGroup#LWG3436) and the current wording is result from there. I was always suspicious about creat

[Bug c++/121068] Placement new of array element is rejected at compile-time

2025-07-21 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121068 Jason Merrill changed: What|Removed |Added Ever confirmed|0 |1 Status|UNCONFIRMED

[Bug c++/121068] Placement new of array element is rejected at compile-time

2025-07-17 Thread tkaminsk at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121068 --- Comment #7 from Tomasz Kamiński --- Or in other words, I believe my example is equivalent to implementation of optional, where we have: union { T val; }; And then call: new(static_cast(addressof(val))) T(...); It is just version were T

[Bug c++/121068] Placement new of array element is rejected at compile-time

2025-07-17 Thread tkaminsk at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121068 --- Comment #6 from Tomasz Kamiński --- I believed that `_member` being active after new should directly fall from the definition of active member in https://eel.is/c++draft/class.union#general-2: > In a union, a non-static data member is active

[Bug c++/121068] Placement new of array element is rejected at compile-time

2025-07-17 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121068 --- Comment #5 from Jason Merrill --- The intent of the patch was to support new (&union_.member) T syntax like union_.member = T() for setting the active member, as in https://eel.is/c++draft/class.union#general-example-3 but adding the li

[Bug c++/121068] Placement new of array element is rejected at compile-time

2025-07-17 Thread tkaminsk at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121068 --- Comment #4 from Tomasz Kamiński --- Hi, the original example works, but when I start to add library fluff, I get the same error. I mean cases like: // passing address to actual member new(&arr) T[3]; new(std::addressof(arr)) T[3]; // Disable

[Bug c++/121068] Placement new of array element is rejected at compile-time

2025-07-16 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121068 --- Comment #3 from Jason Merrill --- Created attachment 61891 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61891&action=edit fix Let me know how this works for you.

[Bug c++/121068] Placement new of array element is rejected at compile-time

2025-07-16 Thread tkaminsk at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121068 --- Comment #2 from Tomasz Kamiński --- That is indeed very surprising, as it would mean that if I have: ``` struct S { union { int x; }; }; constexpr S test() { S s; new(&s.x) int; is_active_member(s.x); // this is false } ``` On

[Bug c++/121068] Placement new of array element is rejected at compile-time

2025-07-16 Thread jason at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121068 Jason Merrill changed: What|Removed |Added CC||jason at gcc dot gnu.org --- Comment #1