<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 --- - Segfault while evaluating a lambda."
   href="http://llvm.org/bugs/show_bug.cgi?id=20599">20599</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Segfault while evaluating a lambda.
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.4
          </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>davidsiaw@gmail.com
          </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>Full source code including build scripts can be found here:
<a href="https://github.com/davidsiaw/serialist">https://github.com/davidsiaw/serialist</a>

Full logs and reproductions can be found here:
<a href="https://travis-ci.org/davidsiaw/serialist/jobs/32029298">https://travis-ci.org/davidsiaw/serialist/jobs/32029298</a>
<a href="https://travis-ci.org/davidsiaw/serialist/jobs/32029968">https://travis-ci.org/davidsiaw/serialist/jobs/32029968</a>

This bug is always reproducible. All the code is available publicly, uses
autoconf and automake to build and a description of the environment can be
found in <a href="http://docs.travis-ci.com/user/ci-environment/">http://docs.travis-ci.com/user/ci-environment/</a>

You can also fork the source code and test it on a ubuntu-like environment.

DESCRIPTION:

The following is an excerpt of the code compiled. clang seems to be segfaulting
on the for_each line at `fmt`. The lambda contains another lambda, and clang is
segfaulting on the inside where fmt.ForeachMember is called. This however works
on g++ 4.8

    void Generate(std::wstring name, std::vector<FormatDesc> format,
std::wostream& output)
    {
        TScheme sch(name);
        sch.GenerateHeader(output);

        for_each(format.begin(), format.end(), [&](FormatDesc fmt)
        {
            sch.GenerateStructOpening(fmt.GetName(), output);

            fmt.ForeachMember([&](FormatMember& member)
            {

Unlike the other bugs, this is a really simple usage of a vector. No static
members, no initializers, no friend class, no user-defined operator().

Could be related to 20046, but there is no call to variable template here
inside the lambda the entire class this function is inside is a template class.</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>