microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

incorrectly formed universal character name using \u{...}

sant123 opened this issue · comments

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:

  1. 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;
}
  1. Compile it, I'm using g++ compiler

Expected behavior:
No error

image

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