Bug 102568 - "taking address of temporary array" error when passing temporary array
Summary: "taking address of temporary array" error when passing temporary array
Status: RESOLVED DUPLICATE of bug 94264
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 12.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-10-02 19:47 UTC by Kamil Kaznowski
Modified: 2021-10-02 20:01 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kamil Kaznowski 2021-10-02 19:47:13 UTC
void foo(int* arr);

int main() {
    using array = int[5];
    foo((array{1, 2, 3, 4, 5}));
}


Gives an error:

<source>: In function 'int main()':
<source>:6:31: error: taking address of temporary array

Problem occurs on all GCC versions 4.7.1 up.
Comment 1 Drea Pinski 2021-10-02 20:01:11 UTC
Dup of bug 94264.

*** This bug has been marked as a duplicate of bug 94264 ***