Skip to content

False positive error C/C++(304) on std::ranges::sort with GCC 16.1 (C++26) #14595

Description

@XLT557

Environment

  • OS and Version: Windows 11
  • VS Code Version: 1.130.0
  • C/C++ Extension Version: 1.32.2
  • If using SSH remote, specify OS of remote machine: N

Bug Summary and Steps to Reproduce

Bug description:
IntelliSense reports a false positive error when using std::ranges::sort with GCC 16.1 in C++26 mode. The exact error message is:

No instance of overloaded function "std::ranges::__sort_fn::operator()" matches the argument list C/C++(304)

The code compiles perfectly fine with GCC 16.1. Interestingly, if I downgrade the compiler to GCC 15.2, IntelliSense works as expected without any squiggles. This seems to be an EDG parser issue with the latest GCC 16.1 standard library implementation for C++26.

Steps to reproduce:

  1. Configure compilerPath to a GCC 16.1 (MinGW-w64) g++.exe.
  2. Set cppStandard to c++26.
  3. Paste the following minimal reproducible example:
#include <iostream>
#include <vector>
#include <algorithm>

namespace ranges = std::ranges;

int main() {
    std::vector a = {2, 8, 9, 0, 1, 3, 6, 4};
    ranges::sort(a); // IntelliSense red squiggle here
}
  1. See error

Expected behavior:
No IntelliSense errors should be reported, as the code is valid and compiles successfully.

Configuration and Logs

### Configuration (`settings.json`)


{
    "C_Cpp.clang_format_fallbackStyle": "Google",
    "C_Cpp.default.compilerArgs": [
        "-std=c++26",
        "-DDEBUG",
        "-fmodules-ts",
        "-lstdc++exp"
    ],
    "C_Cpp.default.compilerPath": "D:\\mingw64\\bin\\g++.exe",
    "C_Cpp.default.cppStandard": "c++26",
    "C_Cpp.default.cStandard": "c23"
}



### C/C++ Log Diagnostics


-------- Diagnostics - 2026/7/24 17:12:22
Version: 1.32.2
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "d:/XCPC/**"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
    ],
    "intelliSenseMode": "windows-gcc-x64",
    "compilerArgs": [
        "-std=c++26",
        "-DDEBUG",
        "-fmodules-ts",
        "-lstdc++exp"
    ],
    "cStandard": "c23",
    "cppStandard": "c++26",
    "intelliSenseModeIsExplicit": false,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "mergeConfigurations": false,
    "recursiveIncludes": {},
    "recursiveIncludesReduceIsExplicit": false,
    "recursiveIncludesPriorityIsExplicit": false,
    "recursiveIncludesOrderIsExplicit": false,
    "compilerPath": "D:\\mingw64\\bin\\g++.exe",
    "compilerPathIsExplicit": true,
    "browse": {
        "limitSymbolsToIncludedHeaders": true
    }
}
Modified Settings:
{
    "C_Cpp.default.compilerPath": "D:\\mingw64\\bin\\g++.exe",
    "C_Cpp.default.compilerArgs": [
        "-std=c++26",
        "-DDEBUG",
        "-fmodules-ts",
        "-lstdc++exp"
    ],
    "C_Cpp.default.cStandard": "c23",
    "C_Cpp.default.cppStandard": "c++26",
    "C_Cpp.clang_format_fallbackStyle": "Google"
}
Additional Tracked Settings:
{
    "editorTabSize": 2,
    "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.32.2.0
Current database path: C:\Users\xlt19\AppData\Local\Microsoft\vscode-cpptools\de25eeb027bd2ff15613efebd025790c\.BROWSE.VC.DB
Translation Unit Mappings:
[ D:\XCPC\test.cpp - source TU]:
Translation Unit Configurations:
[ D:\XCPC\test.cpp ]
    Process ID: 6360
    Memory Usage: 512 MB
    Compiler Path: D:\mingw64\bin\g++.exe
    Include Paths:
        system include: D:\mingw64\lib\gcc\x86_64-w64-mingw32\16.1.0\include\c++
        system include: D:\mingw64\lib\gcc\x86_64-w64-mingw32\16.1.0\include\c++\x86_64-w64-mingw32
        system include: D:\mingw64\lib\gcc\x86_64-w64-mingw32\16.1.0\include\c++\backward
        system include: D:\mingw64\lib\gcc\x86_64-w64-mingw32\16.1.0\include
        system include: D:\mingw64\lib\gcc\x86_64-w64-mingw32\16.1.0\include-fixed
        system include: D:\mingw64\x86_64-w64-mingw32\include
    Defines:
        _DEBUG
        UNICODE
        _UNICODE
        DEBUG
    Standard Version: c++26
    IntelliSense Mode: windows-gcc-x64
    Other Flags:
        --g++
        --gnu_version=160100
Total Memory Usage: 512 MB

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 2846
Number of files parsed: 1152

Other Extensions

No response

Additional context

Compiler Info:

Using built-in specs.
COLLECT_GCC=D:\mingw64\bin\g++.exe
COLLECT_LTO_WRAPPER=D:/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/16.1.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-16.1.0/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/buildroot/x86_64-1610-win32-seh-ucrt-rt_v14-rev1/mingw64 --enable-host-shared --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=win32 --enable-libstdcxx-threads=yes --enable-tls --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-mingw-wildcard --enable-fully-dynamic-string --enable-version-specific-runtime-libs --enable-libstdcxx-filesystem-ts=yes --disable-libssp --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/c/buildroot/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/buildroot/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/buildroot/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/buildroot/prerequisites/x86_64-w64-mingw32-static --with-pkgversion='x86_64-win32-seh-rev1, Built by MinGW-Builds project' --with-bugurl=[https://github.com/niXman/mingw-builds](https://github.com/niXman/mingw-builds) LD_FOR_TARGET=/c/buildroot/x86_64-1610-win32-seh-ucrt-rt_v14-rev1/mingw64/bin/ld.exe --with-boot-ldflags='-pipe -fno-ident -L/c/buildroot/x86_64-1610-win32-seh-ucrt-rt_v14-rev1/mingw64/opt/lib -L/c/buildroot/prerequisites/x86_64-zlib-static/lib -L/c/buildroot/prerequisites/x86_64-w64-mingw32-static/lib  -Wl,--disable-dynamicbase -static-libstdc++ -static-libgcc'
Thread model: win32
Supported LTO compression algorithms: zlib
gcc version 16.1.0 (x86_64-win32-seh-rev1, Built by MinGW-Builds project)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Language ServicebugfixedCheck the Milestone for the release in which the fix is or will be available.parser

    Type

    No type

    Projects

    Status
    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions