microsoft / microsoft/vscode-cpptools

IntelliSense does not recognize the __typeof__ operator

Open
#13,556 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Language Service parser Visual Studio
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Environment
  • OS and Version: Windows 11 24H2
  • VS Code Version: 1.99.3
  • C/C++ Extension Version: 1.24.5
Bug Summary and Steps to Reproduce

Bug Summary:

The C/C++ extension's IntelliSense does not recognize the __typeof__ operator when using MSVC. According to Microsoft's documentation, it should be valid even when not using /std:clatest.

The following C code triggers the error:

int main(void) {
    int a = 0;
    __typeof__(a) b = 0; // This line triggers `expected a ';' - C/C++(65)`.

    return b; // This line triggers `identifier "b" is undefined - C/C++(20)`.
}

The code compiles and runs without any errors or warnings when compiling with /Wall /std:c17.

Expected behavior:

IntelliSense should be able to recognize the __typeof__ and __typeof_unqual__ operators, since they are supported by MSVC, clang and gcc.

Configuration and Logs
c_cpp_properties.json:

{
    "env": {
        "commonIncludePath": [
            "${workspaceFolder}/src/**",
            "${env:VULKAN_SDK}/include/**"
        ],
        "commonDefines": [
            "VK_NO_PROTOTYPES"
        ]
    },
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${commonIncludePath}"
            ],
            "defines": [
                "${commonDefines}",
                "STRICT",
                "WIN32_LEAN_AND_MEAN",
                "OPENWW_PLATFORM_WIN32",
                "VK_USE_PLATFORM_WIN32_KHR"
            ],
            "windowsSdkVersion": "10.0.26100.0",
            "compilerPath": "cl.exe",
            "cStandard": "c17",
            "cppStandard": "c++20",
            "intelliSenseMode": "windows-msvc-x64"
        }
    ],
    "version": 4
}



C/C++: Log Diagnostics:

-------- Diagnostics - 4/26/2025, 5:02:44 PM
Version: 1.24.5
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "e:/Sources/redesigned-octo-engine/src/**",
        "C:/VulkanSDK/1.4.309.0/include/**"
    ],
    "defines": [
        "VK_NO_PROTOTYPES",
        "STRICT",
        "WIN32_LEAN_AND_MEAN",
        "OPENWW_PLATFORM_WIN32",
        "VK_USE_PLATFORM_WIN32_KHR"
    ],
    "windowsSdkVersion": "10.0.26100.0",
    "compilerPath": "cl.exe",
    "cStandard": "c17",
    "cppStandard": "c++20",
    "intelliSenseMode": "windows-msvc-x64",
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "intelliSenseModeIsExplicit": true,
    "compilerPathInCppPropertiesJson": "cl.exe",
    "mergeConfigurations": false,
    "recursiveIncludes": {
        "reduce": "default",
        "priority": "afterSystemIncludes",
        "order": "depthFirst"
    },
    "browse": {
        "limitSymbolsToIncludedHeaders": true
    }
}
Modified Settings:
{
    "C_Cpp.intelliSenseUpdateDelay": 3000,
    "C_Cpp.loggingLevel": "Debug",
    "C_Cpp.autoAddFileAssociations": false
}
Additional Tracked Settings:
{
    "editorTabSize": 4,
    "editorInsertSpaces": true,
    "editorAutoClosingBrackets": "languageDefined",
    "filesEncoding": "utf8",
    "filesAssociations": {},
    "filesExclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/.DS_Store": true,
        "**/Thumbs.db": true
    },
    "filesAutoSaveAfterDelay": false,
    "editorInlayHintsEnabled": true,
    "editorParameterHintsEnabled": true,
    "searchExclude": {
        "**/node_modules": true,
        "**/bower_components": true,
        "**/*.code-search": true
    },
    "workbenchSettingsEditor": "ui"
}
cpptools version (native): 1.24.5.0
Current database path: C:\USERS\ONCIP\APPDATA\LOCAL\MICROSOFT\VSCODE-CPPTOOLS\68BE46447E1B42B5128F8789052FCC11\.BROWSE.VC.DB
Translation Unit Mappings:
[ E:\Sources\redesigned-octo-engine\src\containers\temp.c - source TU]:
Translation Unit Configurations:
[ E:\Sources\redesigned-octo-engine\src\containers\temp.c ]
    Process ID: 2932
    Memory Usage: 58 MB
    Compiler Path: C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.43.34808\bin\Hostx64\x64\cl.exe
    Include paths:
        include: C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.43.34808\include
        include: C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include
        include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt
        include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um
        include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\shared
        include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\winrt
        include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\cppwinrt
        system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um
        system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt
        system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\shared
        system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\winrt
        system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\cppwinrt
    Defines:
        VK_NO_PROTOTYPES
        STRICT
        WIN32_LEAN_AND_MEAN
        OPENWW_PLATFORM_WIN32
        VK_USE_PLATFORM_WIN32_KHR
    Standard Version: ms_c17
    IntelliSense Mode: windows-msvc-x64
    Other Flags:
        --using_directory
        C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.43.34808\lib\x64
        --using_directory
        C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.43.34808\lib\x86\store\references
        --using_directory
        C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.26100.0
        --using_directory
        C:\Program Files (x86)\Windows Kits\10\References\10.0.26100.0
        --using_directory
        C:\Windows\Microsoft.NET\Framework64\v4.0.30319
Total Memory Usage: 58 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 5253


Logs from the language server logging:

LSP: (received) cpptools/rescanFolder
LSP: (invoked) cpptools/rescanFolder
Intellisense update pending for: file:///e%3A/Sources/redesigned-octo-engine/src/containers/temp.c
Discovering files...
Shutting down IntelliSense server: E:\Sources\redesigned-octo-engine\src\containers\queue.c
Shutting down IntelliSense server: E:\Sources\redesigned-octo-engine\src\containers\temp.c
Shutting down IntelliSense server: E:\Sources\redesigned-octo-engine\src\containers\vector.c
  Processing folder (recursive): C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\BUILDTOOLS\VC\TOOLS\MSVC\14.43.34808\INCLUDE
  Processing folder (recursive): C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\BUILDTOOLS\VC\AUXILIARY\VS\INCLUDE
  Processing folder (recursive): C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\CPPWINRT
  Processing folder (recursive): C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\SHARED
  Processing folder (recursive): C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\UCRT
  Processing folder (recursive): C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\UM
  Processing folder (recursive): C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\WINRT
  Processing folder (recursive): C:\VULKANSDK\1.4.309.0\INCLUDE
  Processing folder (recursive): E:\SOURCES\REDESIGNED-OCTO-ENGINE
  Discovering files: 5253 file(s) processed
  0 file(s) removed from database
Done discovering files.
Parsing open files...
Parsing remaining files...
  Parsing: 0 files(s) processed
Done parsing remaining files.
Done parsing open files.
IntelliSense update scheduled and TU acquisition started for: file:///e%3A/Sources/redesigned-octo-engine/src/containers/temp.c
Expanding recursive includes for: E:\SOURCES\REDESIGNED-OCTO-ENGINE\SRC\CONTAINERS\TEMP.C
Done expanding recursive includes for: E:\SOURCES\REDESIGNED-OCTO-ENGINE\SRC\CONTAINERS\TEMP.C
Reducing recursive includes for: E:\SOURCES\REDESIGNED-OCTO-ENGINE\SRC\CONTAINERS\TEMP.C
Done reducing recursive includes for: E:\SOURCES\REDESIGNED-OCTO-ENGINE\SRC\CONTAINERS\TEMP.C
sending compilation args for E:\Sources\redesigned-octo-engine\src\containers\temp.c
  include: C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\BUILDTOOLS\VC\TOOLS\MSVC\14.43.34808\INCLUDE
  include: C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\BUILDTOOLS\VC\AUXILIARY\VS\INCLUDE
  include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\UCRT
  include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\UM
  include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\SHARED
  include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\WINRT
  include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\CPPWINRT
  system include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\UM
  system include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\UCRT
  system include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\SHARED
  system include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\WINRT
  system include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\CPPWINRT
  define: VK_NO_PROTOTYPES
  define: STRICT
  define: WIN32_LEAN_AND_MEAN
  define: OPENWW_PLATFORM_WIN32
  define: VK_USE_PLATFORM_WIN32_KHR
  other: --using_directory
  other: C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.43.34808\lib\x64
  other: --using_directory
  other: C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.43.34808\lib\x86\store\references
  other: --using_directory
  other: C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.26100.0
  other: --using_directory
  other: C:\Program Files (x86)\Windows Kits\10\References\10.0.26100.0
  other: --using_directory
  other: C:\Windows\Microsoft.NET\Framework64\v4.0.30319
  stdver: ms_c17
  intelliSenseMode: windows-msvc-x64
Update IntelliSense time (sec): 0.047
LSP: (received) cpptools/getFoldingRanges: file:///e%3A/Sources/redesigned-octo-engine/src/containers/temp.c (id: 396)
LSP: (invoked) cpptools/getFoldingRanges: file:///e%3A/Sources/redesigned-octo-engine/src/containers/temp.c (id: 396)
LSP: Sending response (id: 396)
LSP: (received) cpptools/getFoldingRanges: file:///e%3A/Sources/redesigned-octo-engine/src/containers/temp.c (id: 397)
LSP: (invoked) cpptools/getFoldingRanges: file:///e%3A/Sources/redesigned-octo-engine/src/containers/temp.c (id: 397)
LSP: Sending response (id: 397)
LSP: (received) cpptools/didChangeActiveEditor: file:///e%3A/Sources/redesigned-octo-engine/src/containers/temp.c
LSP: (invoked) cpptools/didChangeActiveEditor: file:///e%3A/Sources/redesigned-octo-engine/src/containers/temp.c
LSP: (received) cpptools/getDiagnostics (id: 398)
LSP: (invoked) cpptools/getDiagnostics (id: 398)
LSP: Sending response (id: 398)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeActiveEditor: file:///e%3A/Sources/redesigned-octo-engine/src/containers/temp.c
LSP: (invoked) cpptools/didChangeActiveEditor: file:///e%3A/Sources/redesigned-octo-engine/src/containers/temp.c
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
Other Extensions

No response

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal C reproduction using the reported MSVC windows-msvc-x64 and ms_c17 configuration, then locate the IntelliSense parser entry point for typeof. Verify that both typeof and typeof_unqual produce no diagnostics in the shown example, adding a regression test if the repository's existing parser tests cover this path.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, typescript
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.