https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113904
--- Comment #6 from sandra at gcc dot gnu.org --- On further investigation, it appears that both the C and C++ front ends are at least attempting to parse the context selectors in the correct scope, although C++ trips over a "use of parameter outside function body" error. If that's fixed, a code walk would find these things easily enough. I guess we'd only want to do the function wrapper around the expression if it actually references parameters? Certainly not for constants, at least. I'd need help figuring out what to do for Fortran as I'm less familiar both with the language semantics and the front end implementation. I guess there are additional complications due to supporting nested functions/modules.