[llvm-bugs] [Bug 41701] New: Structured bindings on struct failing with clang-cl

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 2 01:05:57 PDT 2019


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: unassignedclangbugs at nondot.org
          Reporter: jvapen at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190502/78d2e110/attachment.html>


More information about the llvm-bugs mailing list