<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 --- - Clang assertion failure on template instantiation"
   href="https://llvm.org/bugs/show_bug.cgi?id=25561">25561</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang assertion failure on template instantiation
          </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>Frontend
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>rtrieu@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>ismail.pazarbasi@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>In clang::Sema::ActOnExplicitInstantiation in lib/Sema/SemaTemplate.cpp:7259,
Clang hits an assertion when attempting to cast a TemplateDecl to a
ClassTemplateDecl.

7259:   ClassTemplateDecl *ClassTemplate = cast<ClassTemplateDecl>(TD);

test.cc:
class A {};
template <template <typename> class B>
class C {
  template class B<A>;
};

clang -cc1 test.cc
clang: ../include/llvm/Support/Casting.h:237: typename cast_retty<X, Y
*>::ret_type llvm::cast(Y *) [X = clang::ClassTemplateDecl, Y =
clang::TemplateDecl]: Assertion `isa<X>(Val) && "cast<Ty>() argument of
incompatible type!"' failed.
...
Stack dump:
0.    Program arguments: clang -cc1 test.cc 
1.    test.cc:4:22: current parser token ';'
2.    test.cc:3:1: parsing struct/union/class body 'C'
Aborted (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>