Issue 233503
Summary [OpenMP] Mapping a binding to an array element is diagnosed as "initialized from temporary object".
Labels clang:frontend, clang:openmp
Assignees zahiraam
Reporter zahiraam
    Mapping a structured binding of an array (`auto [x, y] = arr; #pragma omp target map(x)`) is rejected as "initialized from temporary object", even
though `arr` is a named variable and SemaOpenMP has handling to map such a binding as `arr[0]`. 
```
void f() {
  int arr[2] = {1, 2};
  auto [x, y] = arr;
#pragma omp target map(x)
  x++;
}
```

```
clang -fopenmp -fopenmp-version=51 -std=c++20 -fsyntax-only test.cpp
```

```
<source>:4:24: error: mapping of structured binding initialized from temporary object is not yet supported
    4 | #pragma omp target map(x)
      |                        ^
1 error generated.
```
@alexey-bataev 
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to