Skip to content

CTAD for std::span with a range argument fails #14459

Description

@marralesfios

Environment

  • OS and Version: Arch Linux, kernel 7.0.8.arch1-1
  • VS Code Version: 1.120.0, Commit: 0958016b2af9f09bb4257e0df4a95e2f90590f9f
  • C/C++ Extension Version: 1.32.2

Bug Summary and Steps to Reproduce

Bug Summary:
When x is a range (e.g. std::string), std::span{x} fails static analysis, despite the code being accepted by both gcc and clang.

Steps to reproduce:

  1. Create a new folder
  2. copy test.cpp inside
  3. open the folder then the file
  4. See error
Image

Expected behavior:
No error, std::span<char> is deduced.

Configuration and Logs

c_cpp_properties.json: none needed.
language server logging: see attachment below.

C/C++: Log Diagnostics output:

-------- Diagnostics - 5/18/2026, 3:26:00 PM
Version: 1.32.2
Current Configuration:
{
    "name": "Linux",
    "includePath": [
        "/home/marr-ales-fios/include"
    ],
    "defines": [],
    "intelliSenseMode": "linux-clang-x64",
    "compilerArgs": [
        "-m64",
        "-freflection"
    ],
    "cStandard": "c23",
    "cppStandard": "c++26",
    "intelliSenseModeIsExplicit": false,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "mergeConfigurations": false,
    "recursiveIncludes": {},
    "recursiveIncludesReduceIsExplicit": false,
    "recursiveIncludesPriorityIsExplicit": false,
    "recursiveIncludesOrderIsExplicit": false,
    "compilerPath": "/usr/bin/g++",
    "compilerPathIsExplicit": true,
    "browse": {
        "limitSymbolsToIncludedHeaders": true
    }
}
Modified Settings:
{
    "C_Cpp.intelliSenseUpdateDelay": 500,
    "C_Cpp.autocompleteAddParentheses": true,
    "C_Cpp.suggestSnippets": false,
    "C_Cpp.default.includePath": [
        "/home/marr-ales-fios/include"
    ],
    "C_Cpp.default.compilerPath": "/usr/bin/g++",
    "C_Cpp.default.compilerArgs": [
        "-m64",
        "-freflection"
    ],
    "C_Cpp.default.cStandard": "c23",
    "C_Cpp.default.cppStandard": "c++26",
    "C_Cpp.vcFormat.indent.caseLabels": true,
    "C_Cpp.codeAnalysis.updateDelay": 1000,
    "C_Cpp.debugShortcut": false,
    "C_Cpp.intelliSenseMemoryLimit": 6144,
    "C_Cpp.vcpkg.enabled": false,
    "C_Cpp.loggingLevel": "Debug",
    "C_Cpp.experimentalFeatures": "enabled",
    "C_Cpp.copilotHover": "disabled"
}
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": true,
    "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: /home/marr-ales-fios/.cache/vscode-cpptools/aefb1edb3236c37da9f59a487a5c880c/.browse.VC.db
Translation Unit Mappings:
[ /home/marr-ales-fios/Projects/mre/test.cpp - source TU]:
Translation Unit Configurations:
[ /home/marr-ales-fios/Projects/mre/test.cpp ]
    Process ID: 56841
    Memory Usage: 98 MB
    Compiler Path: /usr/bin/g++
    Include Paths:
        include: /home/marr-ales-fios/include
        system include: /usr/include/c++/16.1.1
        system include: /usr/include/c++/16.1.1/x86_64-pc-linux-gnu
        system include: /usr/include/c++/16.1.1/backward
        system include: /usr/lib/gcc/x86_64-pc-linux-gnu/16.1.1/include
        system include: /usr/local/include
        system include: /usr/include
    Standard Version: c++26
    IntelliSense Mode: linux-gcc-x64
    Other Flags:
        --g++
        --gnu_version=160101
Total Memory Usage: 98 MB

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

Other Extensions

No response

Additional context

Language server logging: lsp.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    Language ServiceVisual StudioInherited from Visual StudiobugfixedCheck 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