https://bugs.llvm.org/show_bug.cgi?id=41701

            Bug ID: 41701
           Summary: Structured bindings on struct failing with clang-cl
           Product: clang
           Version: 7.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: jva...@gmail.com
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
                    neeil...@live.com, richard-l...@metafoo.co.uk

This issue seems to be specific to building with clang-cl (or link with MSVC
STL).
I've tested it on version 7.0.0 with MSVC2017.

I'm using the example of
https://en.cppreference.com/w/cpp/language/structured_binding, which works with
MSVC and Clang on linux. (See https://gcc.godbolt.org/z/EW5TN-), however, fails
with clang-cl.

t.cpp
-----
struct S {
    int x1 : 2;
    volatile double y1;
};
S f();

const auto [x, y] = f(); // x is a const int lvalue identifying the 2-bit bit
field
                         // y is a const volatile double lvalue


run.bat
-------
clang-cl.exe /O2 /std:c++17 t.cpp

error:
------
t.cpp(7,11):  error: cannot decompose this type; 'std::tuple_size<const
S>::value' is not a valid integral constant expression
const auto[x, y] = f(); // x is a const int lvalue identifying the 2-bit bit
field
          ^
1 error generated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to