Open samival opened 2 months ago
Hi @samival . Thanks for reporting this. I can reproduce the issue. We'll investigate.
When GCC uses the -fshort-wchar
compiler switch (like when compiling U-Boot), Intellisense should be informed about this in the settings of C/C++ Tools extension:
C_Cpp › Default: Compiler Args
in @ext:ms-vscode.cpptools
-fshort-wchar
Now, if I write wchar_t* str = L"hehe";
, on hovering over wchar_t
Intellisense correctly says typedef unsigned short wchar_t
. However, hovering over L"hehe"
it says (unsigned int [5])L"hehe"
I wonder if this issue is related to the above one.
Environment
Bug Summary and Steps to Reproduce
Steps to reproduce: Create a .c file with a global wchar_t array and initialize it with a wide char string literal (L"..." ) i.e.
wchar_t s[] = L"ABC";
Bug Summary: On Linux the Intelli-Sense Engine seems to identify wide-character string literals as
unsigned int
arrays whilewchar_t
is typedef'd by GCC to besigned int
, causing a type mismatch which triggers an incorrect error.The error shown is:
a value of type "unsigned int [4]" cannot be used to initialize an entity of type "wchar_t []" (aka "int []")C/C++(144)
Initializing a
const wchar_t *
doesn't produce an error. Initializing in a local scope doesn't produce an error.Some potentially relevant VSCode settings:
Configuration and Logs
Other Extensions
No response
Additional context
No response