https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102568
Bug ID: 102568
Summary: "taking address of temporary array" error when passing
temporary array
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: kamkaz at windowslive dot com
Target Milestone: ---
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.