microsoft / microsoft/vscode-cpptools
typeof incorrectly removes qualifiers in some situations (with C clang/gcc modes)
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: Windows 10
- VS Code Version: 1.100.2
- C/C++ Extension Version: 1.25.3
Bug Summary and Steps to Reproduce
Bug Summary:
Steps to reproduce:
Use typeof with a qualified or atomic lvalue obtained from dereferencing a pointer to a qualified or atomic type, for example:
typedef typeof(*(const int*)0)x;
When hovering over this definition, it reports x as being the type int.
Expected behavior:
The reported type of x should be const int.
Configuration and Logs
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"cStandard": "c23",
"cppStandard": "c++23",
"intelliSenseMode": "linux-gcc-x64",
"compilerPath": "C:/cygwin64/bin/gcc.exe"
}
],
"version": 4
}
Other Extensions
No response
Additional context
This issue does not occur when using an lvalue derived from a name instead of dereferencing a pointer, e.g.:
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
First reproduce the hover result with the provided C23 typeof example in the reported Windows GCC configuration, then trace the IntelliSense type information for a dereferenced pointer to a qualified or atomic type. Done means the reported type preserves the const or atomic qualifier, including for the supplied reproduction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- compilers, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100