Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meta.parameter scope leaks #654

Open
1 task
alexr00 opened this issue Mar 11, 2024 · 1 comment
Open
1 task

meta.parameter scope leaks #654

alexr00 opened this issue Mar 11, 2024 · 1 comment

Comments

@alexr00
Copy link

alexr00 commented Mar 11, 2024

Checklist

  • This problem exists even with the setting "C_Cpp.enhancedColorization": "Disabled"

The code with a problem is:

#include <vector>

std::vector<uint64_t> test(1 << 22);

int main() {
  for (int i = 0; i < (1 << 22); i++) {
    test[i] = i;
  }
  while (true) {
    switch (test[0] % 4) {
      case 0:
        test[0] = test[0] * 0x5deece66d + 0xb;
        break;
      case 1:
        test[0] = test[0] * 0x5deece66d + 0xb;
        break;
      case 2:
        test[0] = test[0] * 0x5deece66d + 0xb;
        break;
      case 3:
        test[0] = test[0] * 0x5deece66d + 0xb;
        break;
    }
  }
  return 0;
}

It looks like:

It looks like meta.parameter.cpp is leaking out of the line std::vector<uint64_t> test(1 << 22);

image

Originally from @clysto in microsoft/vscode#207184

@jeff-hykin
Copy link
Owner

jeff-hykin commented Apr 16, 2024

@clysto I pushed a fix for this specific case, but stuff like

constexpr int a = 5;
std::vector<uint64_t> test(a << 22);

Is still broken because a full/generic fix is going to be tough. Not only does it involve the classic turbofish problem (which is sometimes totally unsolvable), but it also involves function-definition-vs-function-call which for Textmate, is always very hard, and sometimes unsolvable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants