gcc/testsuite/g++.dg/cpp2a/paren-init28.C
raw| 1 | // PR c++/92812 |
| 2 | // P1975R0 |
| 3 | // { dg-do compile { target c++20 } } |
| 4 | |
| 5 | // In both cases the reference declarations lifetime-extend the array |
| 6 | // temporary. |
| 7 | int (&&r)[3] = static_cast<int[3]>(42); |
| 8 | int (&&r2)[1] = static_cast<int[]>(42); |
| 9 | |
| 10 | // Make sure we've lifetime-extended. |
| 11 | // { dg-final { scan-assembler "_ZGR1r_" } } |
| 12 | // { dg-final { scan-assembler "_ZGR2r2_" } } |
| 13 | |
| 14 | // Narrowing is probably OK here. |
| 15 | int (&&r3)[1] = static_cast<int[1]>(1.3); |