<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 --- - wrong initialization after template instantiation for aggregate initialization that implicitly default-constructs"
   href="http://llvm.org/bugs/show_bug.cgi?id=20350">20350</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>wrong initialization after template instantiation for aggregate initialization that implicitly default-constructs
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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>C++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>richard-llvm@metafoo.co.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Clang rejects-valid on this:

namespace NoExtraCopy {
  struct S { S(); S(const S&) = delete; };
  struct T { S s; };
  template<typename> void f() {
    T t = {};
  }
  template void f<int>();
}

... because the template instantiation of the initializer initializes the S
subobject from the existing CXXConstructExpr, resulting in an unnecessary move
construction.

We should either make TreeTransform::TransformInitializer recurse through
InitListExprs (and throw away things that were implied), or (better) not redo
initialization sequence formation during template instantiation if we succeeded
in building the initialization sequence in the initial parse.

(In the latter case, we'd probably benefit from an AST node representing a
dependent initialization sequence, so we can get TreeTransform to rerun the
initialization step where needed.)</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>