Skip to content

Intellisense does not assume C23 when using CMake with c_std_23 #14560

Closed

Description

Environment

  • OS and Version: Arch
  • VS Code Version: C/C++ prerelease (1.33.2?)
  • C/C++ Extension Version: C23

Bug Summary and Steps to Reproduce

Bug Summary:

Steps to reproduce:

  1. Create a basic Cmake file using c_std_23 as the language version. Then generate with compile commands.
  2. In VSCode, things like nullptr, bool etc are not at all recognized.

What is really happening is that CMake correctly assumes that C23 is the standard for GCC and completely omits -std=c23 (or gnu23) from the command-line in compile-commands.json. Hence, the language server does not know that C23 is used and just falls back to C99 (likely). Clangd shows this exact same behavior. C99 is no longer a correct default to fall back to. Hasn't been for a while.

Expected behavior:
Intellisense should be compiler version aware and know that C23 is implicit if no flags are specified.

Configuration and Logs

The fix is just to specify C23 in c_cpp_properties.json. If this file is not provided; intellisense defaults are incorrect:

{
    "version": 4,
    "configurations": [
        {
            "name": "Linux",
            "compilerPath": "/usr/bin/cc",
            "cStandard": "c23",
            "intelliSenseMode": "linux-gcc-x64",
            "compileCommands": "${workspaceFolder}/build/compile_commands.json"
        }
    ]
}

And then suddenly intellisense has basic C23 support (somewhat.. at least it doesn't complain anymore)

Other Extensions

No response

Additional context

No response

Activity

  1. sean-mcmanus commented on Jul 3, 2026

    @sean-mcmanus
    Contributor

    Robin 'Ruadeil' Degen (@robindegen) It appears that gcc 15 switched the default standard to C23, but not gcc 14 or earlier or with the latest clang or msvc compilers.

    IntelliSense is using c17 by default because gcc is reporting __STDC_ISO_10646__ 201706L as the define.

  2. sean-mcmanus commented on Jul 3, 2026

    @sean-mcmanus
    Contributor

    Robin 'Ruadeil' Degen (@robindegen) It appears the gcc default is actually C17, but it's silently accepting C23 code: __STDC_ISO_10646__ is still 201706L.

  3. sean-mcmanus commented on Jul 3, 2026

    @sean-mcmanus
    Contributor

    Robin 'Ruadeil' Degen (@robindegen) It appears to use C23 because gcc is implementing those particular C23 features you're using as a language extension for C17, which our EDG compiler doesn't properly take into account yet.

  4. moved this from Todo to In progress in cpptoolson Aug 27, 2026
  5. sean-mcmanus commented on Aug 27, 2026

    @sean-mcmanus
    Contributor

    Actually, I was mistaken. GCC does use C23 by default -- the bug appears to be we're incorrectly setting the default as c17.

  6. moved this from In progress to Pull Request in cpptoolson Aug 27, 2026
  7. added
    fixedCheck the Milestone for the release in which the fix is or will be available.
    on Aug 27, 2026
  8. sean-mcmanus commented on Aug 29, 2026

    @sean-mcmanus
    Contributor
  9. moved this from Pull Request to Done in cpptoolson Sep 9, 2026
  10. locked and limited conversation to collaborators on Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Language ServicebugfixedCheck the Milestone for the release in which the fix is or will be available.verifiedBug has been reproduced

Type

Projects

  • Status
    Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions