gcc/testsuite/g++.dg/gomp/pr56217.C
raw| 1 | // PR middle-end/56217 |
| 2 | // { dg-do compile { target c++20_down } } |
| 3 | // { dg-options "-fopenmp" } |
| 4 | |
| 5 | struct S { int *p; S (); S (S &); }; |
| 6 | |
| 7 | S |
| 8 | foo () |
| 9 | { |
| 10 | S s; |
| 11 | #pragma omp task shared (s) |
| 12 | s.p = 0; |
| 13 | // This fails in C++23, because "cannot bind non-const lvalue reference of |
| 14 | // type 'S&' to an rvalue of type 'S'". |
| 15 | return s; |
| 16 | } |