<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </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::array is unable to be brace-initialized/universally initialized"
   href="http://llvm.org/bugs/show_bug.cgi?id=19192">19192</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>std::array is unable to be brace-initialized/universally initialized
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.3
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </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>mjbshaw@hotmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu, mclow.lists@gmail.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>After a Q&A on StackOverflow[1], it seems there is a bug in libc++ (though I
suppose it could be in the clang front end instead of libc++; I'm assuming
libc++) that prevents std::array from being brace-initialized. Consider the
following:

std::array<int, 2> a = {1, 2};
std::array<int, 2> b{a}; // error: no viable conversion from 'std::array<int,
2>' to 'value_type' (aka 'int')
std::array<int, 2> b(a); // works

b{a} is trying to initialize b by creating an initializer list with a in it, as
opposed to using brace/universal initialization (which would be equivalent to
b(a), which works as expected).


[1]:
<a href="http://stackoverflow.com/questions/22495624/why-does-this-compile-with-visual-studio-2013-but-not-g-4-8-1">http://stackoverflow.com/questions/22495624/why-does-this-compile-with-visual-studio-2013-but-not-g-4-8-1</a></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>