Skip to content

Support multidimensional array subscript operator with windows-clang-x64 #11400

Open
@BluTree

Description

@BluTree

Environment

  • OS and Version: Windows 11 (22621.2134)
  • VS Code Version: 1.81.1
  • C/C++ Extension Version: 1.17.5

Bug Summary and Steps to Reproduce

Bug Summary:
The C++23 standard support multidimensional array subscript (i.e operator[](int a, int b)), but the C++ extension outputs errors even with the cppStandard to c++23 and with a compatible compiler (clang 16).

Steps to reproduce:

  1. Create a file containing this snippet :
struct A
{
    int& operator[](int x, int y)
    {
        return _data[x * 3 + y];
    }

    int _data[9] {0};
};

int main()
{
    A a;

    a[0, 0] = 0;
}
  1. Set the c++ standard to 23 and compiler to clang
  2. Notice the error, while it compiles with -std=c++2b on the file

Expected behavior:
No error

Configuration and Logs

-------- Diagnostics - 9/3/2023, 4:32:28 PM
Version: 1.17.5
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "c:/Dev/Sources/YetAnotherEngine/src/**",
        "c:/Dev/Sources/YetAnotherEngine/lib/*",
        "c:/Dev/Sources/YetAnotherEngine/lib/imgui/*",
        "c:/Dev/Sources/YetAnotherEngine/lib/glfw/include/*"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
    ],
    "intelliSenseMode": "windows-clang-x64",
    "cppStandard": "c++23",
    "compilerArgs": [],
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": true,
    "intelliSenseModeIsExplicit": true,
    "mergeConfigurations": false,
    "compilerPath": "C:\\Dev\\LLVM\\bin\\clang.exe",
    "browse": {
        "path": [
            "c:/Dev/Sources/YetAnotherEngine/src/**",
            "c:/Dev/Sources/YetAnotherEngine/lib/*",
            "c:/Dev/Sources/YetAnotherEngine/lib/imgui/*",
            "c:/Dev/Sources/YetAnotherEngine/lib/glfw/include/*",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
cpptools version (native): 1.17.5.0
Translation Unit Mappings:
[ C:\Dev\Sources\YetAnotherEngine\src\Core\Math\Vector\Vector2.cpp ]:
    C:\Dev\Sources\YetAnotherEngine\src\Core\Math\Vector\Vector2.h *
[ C:\Dev\Sources\YetAnotherEngine\src\Core\Math\Matrix\Matrix3.cpp ]:
    C:\Dev\Sources\YetAnotherEngine\src\Core\Math\Matrix\Matrix3.cpp
    C:\Dev\Sources\YetAnotherEngine\src\Core\Math\Matrix\Matrix3.h *
[ C:\Dev\Sources\YetAnotherEngine\src\main.cpp ]:
    C:\Dev\Sources\YetAnotherEngine\src\main.cpp
Translation Unit Configurations:
[ C:\Dev\Sources\YetAnotherEngine\src\Core\Math\Vector\Vector2.cpp ]:
    Process ID: 19356
    Memory Usage: 132 MB
    Compiler Path: C:\Dev\LLVM\bin\clang.exe
    Includes:
        C:\Dev\Sources\YetAnotherEngine\lib
        C:\Dev\Sources\YetAnotherEngine\lib\imgui
        C:\Dev\Sources\YetAnotherEngine\lib\glfw\include
        C:\Dev\LLVM\lib\clang\16\include
        C:\Dev\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include
        C:\Dev\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\atlmfc\include
        C:\Windows Kits\10\Include\10.0.22000.0\ucrt
        C:\Windows Kits\10\Include\10.0.22000.0\shared
        C:\Windows Kits\10\Include\10.0.22000.0\um
        C:\Windows Kits\10\Include\10.0.22000.0\winrt
        C:\Windows Kits\10\Include\10.0.22000.0\cppwinrt
        C:\Dev\Sources\YetAnotherEngine\src
    Defines:
        _DEBUG
        UNICODE
        _UNICODE
    Standard Version: c++23
    IntelliSense Mode: windows-clang-x64
    Other Flags:
        --clang
        --clang_version=160000
        --ms_compatibility
[ C:\Dev\Sources\YetAnotherEngine\src\Core\Math\Matrix\Matrix3.cpp ]:
    Process ID: 23312
    Memory Usage: 59 MB
    Compiler Path: C:\Dev\LLVM\bin\clang.exe
    Includes:
        C:\Dev\Sources\YetAnotherEngine\lib
        C:\Dev\Sources\YetAnotherEngine\lib\imgui
        C:\Dev\Sources\YetAnotherEngine\lib\glfw\include
        C:\Dev\LLVM\lib\clang\16\include
        C:\Dev\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include
        C:\Dev\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\atlmfc\include
        C:\Windows Kits\10\Include\10.0.22000.0\ucrt
        C:\Windows Kits\10\Include\10.0.22000.0\shared
        C:\Windows Kits\10\Include\10.0.22000.0\um
        C:\Windows Kits\10\Include\10.0.22000.0\winrt
        C:\Windows Kits\10\Include\10.0.22000.0\cppwinrt
        C:\Dev\Sources\YetAnotherEngine\src
    Defines:
        _DEBUG
        UNICODE
        _UNICODE
    Standard Version: c++23
    IntelliSense Mode: windows-clang-x64
    Other Flags:
        --clang
        --clang_version=160000
        --ms_compatibility
[ C:\Dev\Sources\YetAnotherEngine\src\main.cpp ]:
    Process ID: 25544
    Memory Usage: 127 MB
    Compiler Path: C:\Dev\LLVM\bin\clang.exe
    Includes:
        C:\Dev\Sources\YetAnotherEngine\lib
        C:\Dev\Sources\YetAnotherEngine\lib\imgui
        C:\Dev\Sources\YetAnotherEngine\lib\glfw\include
        C:\Dev\LLVM\lib\clang\16\include
        C:\Dev\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include
        C:\Dev\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\atlmfc\include
        C:\Windows Kits\10\Include\10.0.22000.0\ucrt
        C:\Windows Kits\10\Include\10.0.22000.0\shared
        C:\Windows Kits\10\Include\10.0.22000.0\um
        C:\Windows Kits\10\Include\10.0.22000.0\winrt
        C:\Windows Kits\10\Include\10.0.22000.0\cppwinrt
        C:\Dev\Sources\YetAnotherEngine\src
    Defines:
        _DEBUG
        UNICODE
        _UNICODE
    Standard Version: c++23
    IntelliSense Mode: windows-clang-x64
    Other Flags:
        --clang
        --clang_version=160000
        --ms_compatibility
Total Memory Usage: 319 MB

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

Other Extensions

No response

Additional context

image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions