microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.45k stars 1.53k forks source link

False intellisense error with defaulted template parameter of `decltype(lambda)` in C++20/23 #12588

Open sam20908 opened 3 weeks ago

sam20908 commented 3 weeks ago

Environment

Bug Summary and Steps to Reproduce

Bug Summary:

False intellisense error for the following minimal snippet :

template <typename T = decltype([](int a, int b) {})>
struct S {
  S(T t = {}) {}
};

void solve() {
  S s; // no viable template argument deduction candidate found for class template "S"C/C++(3165)
}

Steps to reproduce:

  1. Paste the following snippet
  2. Set the C++ Standard to C++20/23 in "C/C++: Edit Configurations"
  3. See error

Expected behaviour: Intellisense should not emit an error.

Configuration and Logs

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "LC_LOCAL"
            ],
            "compilerPath": "/usr/bin/g++-13",
            "cStandard": "c17",
            "cppStandard": "c++20",
            "intelliSenseMode": "linux-gcc-x64",
            "configurationProvider": "ms-vscode.cmake-tools"
        }
    ],
    "version": 4
}

-------- Diagnostics - 8/19/2024, 9:48:10 AM
Version: 1.21.6
Current Configuration:
{
    "name": "Linux",
    "includePath": [
        "/home/sames/proj/competitive-programming/**"
    ],
    "defines": [
        "LC_LOCAL"
    ],
    "compilerPath": "/usr/bin/g++-13",
    "cStandard": "c17",
    "cppStandard": "c++20",
    "intelliSenseMode": "linux-gcc-x64",
    "configurationProvider": "ms-vscode.cmake-tools",
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "intelliSenseModeIsExplicit": true,
    "compilerPathInCppPropertiesJson": "/usr/bin/g++-13",
    "configurationProviderInCppPropertiesJson": "ms-vscode.cmake-tools",
    "mergeConfigurations": false,
    "browse": {
        "path": [
            "/home/sames/proj/competitive-programming/**",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
cpptools version (native): 1.21.6.0
Translation Unit Mappings:
[ /home/sames/proj/competitive-programming/cp/F.cpp - source TU]:
Translation Unit Configurations:
[ /home/sames/proj/competitive-programming/cp/F.cpp ]:
    Process ID: 3649
    Memory Usage: 16 MB
    Compiler Path: /usr/bin/g++-13
    Includes:
    System Includes:
        /usr/include/c++/13
        /usr/include/x86_64-linux-gnu/c++/13
        /usr/include/c++/13/backward
        /usr/lib/gcc/x86_64-linux-gnu/13/include
        /usr/local/include
        /usr/include/x86_64-linux-gnu
        /usr/include
    Defines:
        LC_LOCAL
    Standard Version: c++20
    IntelliSense Mode: linux-gcc-x64
    Other Flags:
        --g++
        --gnu_version=130100
Total Memory Usage: 16 MB

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

Other Extensions

No response

Additional context

No response

EmosewaMC commented 3 weeks ago

could be a duplicate of my issue in #12586 with a very similar issue