<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 --- - assertion failure assigning to immutable generic lambda init-capture"
   href="http://llvm.org/bugs/show_bug.cgi?id=20717">20717</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>assertion failure assigning to immutable generic lambda init-capture
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </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++1y
          </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>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This testcase:

  auto x = [i = 0](auto n) { return i += n; }(1);

... causes clang to assert in C++14 mode:

clang-3.5: include/llvm/Support/Casting.h:95: static bool
llvm::isa_impl_cl<clang::Decl, const clang::DeclCo
ntext *>::doit(const From *) [To = clang::Decl, From = const clang::DeclContext
*]: Assertion `Val && "isa<> used on a null pointer"' failed.

The bad cast<...> call on a null pointer is here:

#9  0x000000000260cdc5 in clang::DeclContext::getParent (this=0x0)
    at tools/clang/include/clang/AST/DeclBase.h:1090
#10 0x0000000003866b0f in isReferenceToNonConstCapture (S=..., E=0x5c97798)
    at tools/clang/lib/Sema/SemaExpr.cpp:8487
#11 0x00000000037bc06a in CheckForModifiableLvalue (E=0x5c97798, Loc=...,
S=...)
    at tools/clang/lib/Sema/SemaExpr.cpp:8515</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>