aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/paren-init28.C
blob: 8c57dc8e15533a79350bdb074e51c95d7f3d3c0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// PR c++/92812
// P1975R0
// { dg-do compile { target c++20 } }

// In both cases the reference declarations lifetime-extend the array
// temporary.
int (&&r)[3] = static_cast<int[3]>(42);
int (&&r2)[1] = static_cast<int[]>(42);

// Make sure we've lifetime-extended.
// { dg-final { scan-assembler "_ZGR1r_" } }
// { dg-final { scan-assembler "_ZGR2r2_" } }

// Narrowing is probably OK here.
int (&&r3)[1] = static_cast<int[1]>(1.3);