https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127982

            Bug ID: 127982
           Summary: [OpenMP][5.x][6.x] Mapping C++ Lambda – 6.x changes &
                    corner cases
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: openmp
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

Follow-up to PR 127559

Newer features:

OpenMP 6.0 added "mapping lambda captures" (OpenMP spec Issue #2691)
OpenMP 6.1 clarified: "Implicit mapping of variable captured by reference"
(#3277)

See also PR 127559 for testcases that should be added and some generic
discussion, but in particular:

https://gcc.gnu.org/pipermail/gcc-patches/2026-October/735072.html

[Quoting from that link, but it has more]

"lambda mapping in the C++ FE is IMHO misplaced, I think
it shouldn't be based on target region's body search, but done during
clause processing at gimplification time"

- and -

"The PR contains some testcases and examples how to construct various
aggregates for testing.  What e.g. the current walking of body can't handle is

template <typename T> struct S { T x; int y; };

template <typename T> int bar (T &x) { return x.x (); }
void foo (int x)
{
  auto b = [&] { return x; };
  S <decltype (b)> c = { b, 42 };
  #pragma omp target
  if (bar (c) != 42) __builtin_abort ();
}

int main () { foo (42); }


Here the walk doesn't see any expression with LAMBDA_TYPE_P type
in the body."

Reply via email to