<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 - std::indirect_array::operator= gives wrong result."
   href="https://bugs.llvm.org/show_bug.cgi?id=34515">34515</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>std::indirect_array::operator= gives wrong result.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>All Bugs
          </td>
        </tr>

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

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

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>#include "iostream"
#include <valarray>

int main()  {
  int input[] = { 0, 1, 2, 3, 4, 5, 6 };
  std::valarray<int>            filled(input, 7);

  size_t indexes[] = { 1, 3, 4, 6 };
  std::valarray<size_t> index(indexes, 4);
  size_t indexes2[] = { 1, 2, 3, 4 };
  std::valarray<size_t> index2(indexes2, 4);

  const std::indirect_array<int> result = filled[index];
  const std::indirect_array<int> result2 = filled[index2];
  result = result2;

  std::valarray<int> temp(result);
  for (int i = 0; i < temp.size(); i++)
    std::cout << temp[i] << " ";
}

using clang, this will print:
1 2 2 2


using msvc or gcc, this will print:
1 2 3 4</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>