<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Structured bindings on struct failing with clang-cl"
   href="https://bugs.llvm.org/show_bug.cgi?id=41701">41701</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Structured bindings on struct failing with clang-cl
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>7.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jvapen@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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
<a href="https://en.cppreference.com/w/cpp/language/structured_binding">https://en.cppreference.com/w/cpp/language/structured_binding</a>, which works with
MSVC and Clang on linux. (See <a href="https://gcc.godbolt.org/z/EW5TN">https://gcc.godbolt.org/z/EW5TN</a>-), 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.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>