Bug 115744 - [C++26] P2747R2 - constexpr placement new
Summary: [C++26] P2747R2 - constexpr placement new
Status: ASSIGNED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 15.0
: P3 normal
Target Milestone: ---
Assignee: Jakub Jelinek
URL:
Keywords:
Depends on:
Blocks: c++26-core 115754
  Show dependency treegraph
 
Reported: 2024-07-02 08:41 UTC by Jakub Jelinek
Modified: 2024-07-03 09:45 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2024-07-02 00:00:00


Attachments
gcc15-pr115744-wip.patch (1.64 KB, patch)
2024-07-02 14:01 UTC, Jakub Jelinek
Details | Diff
gcc15-pr115744.patch (2.38 KB, patch)
2024-07-03 09:45 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2024-07-02 08:41:39 UTC
See <https://wg21.link/P2747R2>.
Comment 1 Jakub Jelinek 2024-07-02 14:01:28 UTC
Created attachment 58563 [details]
gcc15-pr115744-wip.patch

Untested WIP patch.
Comment 2 Jason Merrill 2024-07-02 14:10:35 UTC
(In reply to Jakub Jelinek from comment #1)
> Untested WIP patch.

In the conversion lval change, I'd think we want vc_discard for conversion to void, and to pass through whatever lval for VIEW_CONVERT_EXPR.
Comment 3 Jakub Jelinek 2024-07-03 09:45:38 UTC
Created attachment 58580 [details]
gcc15-pr115744.patch

With the PR115754 change in, this seems mostly about the FTMs and making placement new constexpr.
The only thing that doesn't work is the
new (p + 1) int[]{2, 3};      // error (in this paper)
case from the paper xfailed in the last testcase, the IL has there
<<< Unknown tree: expr_stmt
  (void) (TARGET_EXPR <D.2640, (void *) TARGET_EXPR <D.2641, VIEW_CONVERT_EXPR<int *>(b) + 4>>, TARGET_EXPR <D.2642, operator new [] (8, NON_LVALUE_EXPR <D.2640>)>,   int * D.2643;
  <<< Unknown tree: expr_stmt
    (void) (D.2643 = (int *) D.2642) >>>;
and so there is nothing that would trigger some error during constexpr evaluation.
Shouldn't build_new_1 for maybe_constexpr_fn (current_function_decl) in the array_p case add some extra cast to the array type it is looking for rather
than just the ultimate element type?