MaskRay / ccls

C/C++/ObjC language server supporting cross references, hierarchies, completion and semantic highlighting
Apache License 2.0
3.73k stars 254 forks source link

failure to find reference to variable in lambda capture #907

Open Jacob-Burckhardt opened 1 year ago

Jacob-Burckhardt commented 1 year ago

Observed behavior

It fails to find references to the variable "i".

int main() {
   int i=0; // line 2
   return [captureVar=i](){ return captureVar; }(); // line 3
}

Expected behavior

It should have found the reference to "i" on line 3.

Steps to reproduce

  1. Put the cursor on "i" on line 2.
  2. In emacs, run M-x xref-find-references.

System information