Skip to content

<mdspan>: Using std::mdspan results in multiple warnings (C5246) #4477

@dasmysh

Description

@dasmysh

Describe the bug

When just initializing an std::mdspan with dynamic extents multiple warnings (C5246) are produced during compilation.

Command-line test case

C:\Temp>type mdspan_testcase.cpp
#include <array>
#include <mdspan>

int main()
{
    std::array test_data{0, 1, 2, 3, 4, 5};
    std::mdspan<int, std::dextents<std::size_t, 2>> test_span(test_data.data(), 2, 3); // mdspan(329,54): warning C5246 + mdspan(124,50): warning C5246
    return 0;
}

C:\Temp>cl /EHsc /Wall /WX /std:c++latest .\mdspan_testcase.cpp
[...]

multiple C5246 warnings occur.

Expected behavior

Compiles without warnings.

STL version

```
Microsoft Visual Studio Community 2022 (64-Bit) - Preview
Version 17.10.0 Preview 1.0
```

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixedSomething works now, yay!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions