microsoft / microsoft/vscode-cpptools
incorrectly formed universal character name using \u{...}
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Environment
- OS and Version: Fedora 40
- VS Code Version: 1.89.1
- C/C++ Extension Version: 1.20.5
Bug Summary and Steps to Reproduce
Bug Summary:
When writing std::string utf8_str = "\u{1F604}"; into a cpp file, the language server says incorrectly formed universal character name C/C++(965) however compilation and execution works fine.
Steps to reproduce:
- Create a cpp file an copy/paste this code:
#include <iostream>
int main() {
std::string utf8_str = "\u{1F604}";
std::cout << "UTF-8 string: " << utf8_str << std::endl;
return 0;
}
- Compile it, I'm using g++ compiler
Expected behavior:
No error
Configuration and Logs
{
"configurations": [
{
"name": "Linux",
"includePath": ["${workspaceFolder}/**"],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c17",
"cppStandard": "gnu++17",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}
Other Extensions
No response
Additional context
https://en.cppreference.com/w/cpp/language/escape
Note \u{n...} (since C++23) -> code point U+n... (arbitrary number of hexadecimal digits)
My compiler is using C++17 and works, also tried to change cppStandard to gnu++23 but still persist the error
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Use the provided C++ snippet as the reproduction case, first compiling it with g++ and checking the language-server diagnostic under the supplied c_cpp_properties configuration. Compare the diagnostic with cppStandard set to gnu++17 and gnu++23; done means the valid universal character name no longer produces an incorrect error while the existing compilation behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100