<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:Florian.Hahn@arm.com" title="Florian Hahn <Florian.Hahn@arm.com>"> <span class="fn">Florian Hahn</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED WORKSFORME - clang++ crashes while compiling c++14"
   href="https://llvm.org/bugs/show_bug.cgi?id=28865">bug 28865</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">CC</td>
           <td>
                
           </td>
           <td>Florian.Hahn@arm.com
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>WORKSFORME
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED WORKSFORME - clang++ crashes while compiling c++14"
   href="https://llvm.org/bugs/show_bug.cgi?id=28865#c2">Comment # 2</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED WORKSFORME - clang++ crashes while compiling c++14"
   href="https://llvm.org/bugs/show_bug.cgi?id=28865">bug 28865</a>
              from <span class="vcard"><a class="email" href="mailto:Florian.Hahn@arm.com" title="Florian Hahn <Florian.Hahn@arm.com>"> <span class="fn">Florian Hahn</span></a>
</span></b>
        <pre>I could not reproduce the segfault with a recent build of clang++ (clang
version 4.0.0 (<a href="https://github.com/llvm-mirror/clang.git">https://github.com/llvm-mirror/clang.git</a>
7f60b40f08d9c4f13f9b5a7cbbd98468d3345100)
(<a href="https://github.com/llvm-mirror/llvm.git">https://github.com/llvm-mirror/llvm.git</a>
bd807b784e82c1f26339d45f9bf64847f42575e4).



With `clang++ -std=c++14 -c guard.cpp` clang++ produces the following errors:

guard.cpp:19:15: error: cannot initialize return object of type
'result_of_t<(lambda at
      guard.cpp:49:37) ()>' with an rvalue of type 'result_of_t<(lambda at
guard.cpp:50:16)
      ()>'
  else return guard(rest...);
              ^~~~~~~~~~~~~~
guard.cpp:49:24: note: in instantiation of function template specialization
'guard<(lambda at
      guard.cpp:49:37), bool, (lambda at guard.cpp:50:16)>' requested here
  auto type_mismatch = guard(false, []() { return 5; },
                       ^
1 error generated.


------

Erik's example also produces a proper error message.

I'll close this issue for now.</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>