Re: [PATCH] c++: fix broken copy elision with nested TARGET_EXPRs [PR105550]

2022-06-02 Thread Jason Merrill via Gcc-patches
On 5/26/22 11:01, Marek Polacek wrote: In this problem, we are failing to properly perform copy elision with a conditional operator, so this: constexpr A a = true ? A{} : A{}; fails with: error: 'A{((const A*)(&))}' is not a constant expression The whole initializer is TARGET_EXPR }

[PATCH] c++: fix broken copy elision with nested TARGET_EXPRs [PR105550]

2022-05-26 Thread Marek Polacek via Gcc-patches
In this problem, we are failing to properly perform copy elision with a conditional operator, so this: constexpr A a = true ? A{} : A{}; fails with: error: 'A{((const A*)(&))}' is not a constant expression The whole initializer is TARGET_EXPR }> : TARGET_EXPR }>> where the outermost TAR