https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118321
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Tobias Burnus <bur...@gcc.gnu.org>: https://gcc.gnu.org/g:5e91be6f8ce978e1d30c8a958072545002168ed1 commit r15-6996-g5e91be6f8ce978e1d30c8a958072545002168ed1 Author: Tobias Burnus <tbur...@baylibre.com> Date: Fri Jan 17 14:25:18 2025 +0100 OpenMP/C++: Fix declare_variant's 'adjust_args' if there is a 'this' pointer [PR118321] The adjust_args clause is internally store as the i-th argument to the function, which fails if hidden arguments come before. This commit handles the C++ 'this' pointer by shifting the internal arg index by one. PR fortran/118321 gcc/cp/ChangeLog: * decl.cc (omp_declare_variant_finalize_one): Shift adjust_args index by one for non-static class function's 'this' pointer. gcc/testsuite/ChangeLog: * g++.dg/gomp/adjust-args-4.C: New test.