<html>
    <head>
      <base href="https://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 --- - llc code generation for lambda"
   href="https://llvm.org/bugs/show_bug.cgi?id=26789">26789</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>llc code generation for lambda
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>paz215@lehigh.edu
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Test code:

void f(const std::string& arg = "Main")
{
    std::cout << arg ;
}

auto fp() -> void(*)(const std::string&)
{
    return f;
}

int main()
{
    fp()("Pointer");
}

Using both versions (3.7 and 3.9), it fails with an segmentation fault with
llc:

$ llc-3.7 -march=cpp test.ll  -o  ir_lambda.cpp
0  libLLVM-3.7.so.1 0x00007fc945bb4900
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 64
1  libLLVM-3.7.so.1 0x00007fc945bb3d61
2  libc.so.6        0x00007fc944fb52b0
3  libc.so.6        0x00007fc9450cd906
4  libLLVM-3.7.so.1 0x00007fc945be15a1 llvm::raw_ostream::copy_to_buffer(char
const*, unsigned long) + 49
5  libLLVM-3.7.so.1 0x00007fc945be164c llvm::raw_ostream::write(char const*,
unsigned long) + 92
6  libLLVM-3.7.so.1 0x00007fc94642da91
7  libLLVM-3.7.so.1 0x00007fc9464312fc
8  libLLVM-3.7.so.1 0x00007fc9464316c9
9  libLLVM-3.7.so.1 0x00007fc94643250c
10 libLLVM-3.7.so.1 0x00007fc945e6c7b4
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 772
11 llc-3.7          0x000000000041419b
12 llc-3.7          0x000000000040e608 main + 392
13 libc.so.6        0x00007fc944fa0a00 __libc_start_main + 240
14 llc-3.7          0x000000000040e679 _start + 41
Stack dump:
0.      Program arguments: llc-3.7 -march=cpp func-call.ll -o ir_func.cpp
1.      Running pass 'C++ backend' on module 'func-call.ll'.
Segmentation fault (core dumped)</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>