[BUG] The arrow -> in trailing return type syntax breaks C++ syntax highlighting
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
C++ syntax highlighting does not work for any block of code that contains a trailing return type due to the arrow: auto bar() -> int.
An arrow made with the same characters has other uses (e.g. as a member access operator), but the other uses do not break syntax highlighting.
What Should Happen?
C++ syntax highlighting should work when a trailing return type arrow appears in a code block.
Error Messages/Logs
Steps to Reproduce
Instruct Claude to output these lines as C++ code.
// breaks
auto f() -> int { return 0; }
auto f(int x) -> const char* { return "hi"; }
auto f(int x, double y) -> std::vector<int> { return {}; }
// fine
auto square = [](int x) -> int { return x * x; };
int g() { return 0; }
int* ptr = nullptr;
int val = ptr->x;
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.101
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗