<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 --- - (Brace-) Copy-Initialization of lambda-member variables of class-templates fails with “error: excess elements in struct initializer”"
   href="http://llvm.org/bugs/show_bug.cgi?id=22759">22759</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>(Brace-) Copy-Initialization of lambda-member variables of class-templates fails with “error: excess elements in struct initializer”
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.5
          </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++11
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>florian.weber@sfz-bw.de
          </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>Compiling the following code fails with clang 3.5:

===========================

template<typename T>
struct my_class {
    my_class(T arg): t{arg} {}
    T t;
};

int main() {
    auto lambda = []{};
    my_class<decltype(lambda)>{lambda};
}

==========================
$ uname -a
Linux terra 3.14.32-1-lts #1 SMP Fri Feb 6 20:51:49 CET 2015 x86_64 GNU/Linux
$ clang++ --version
clang version 3.5.1 (tags/RELEASE_351/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
$ clang++ -std=c++11 test.cpp 
test.cpp:4:21: error: excess elements in struct initializer
        my_class(T arg): t{arg} {}
                           ^~~
test.cpp:10:2: note: in instantiation of member function 'my_class<(lambda at
test.cpp:9:16)>::my_class' requested here
        my_class<decltype(lambda)>{lambda};
        ^
1 error generated.

==========================

Since lambdas do have copy-constructors I am very positive that this code
should compile and gcc agrees with me here. Otherwise the error-message would
certainly need improvement.</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>