<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed with template destructor error"
   href="https://bugs.llvm.org/show_bug.cgi?id=33168">33168</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed with template destructor error
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>4.0
          </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++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>russell_gallop@sn.scee.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Tested at r303428. This code is invalid but still shouldn't crash. Before
r283789 the error is reported without a crash.

$ cat test.cpp
struct A {
template<class T> ~A() { T t; };
};
$ clang -c test.cpp
test.cpp:2:19: error: destructor cannot be declared as a template
template<class T> ~A() { T t; };
                  ^
clang-5.0: <...>/llvm/include/llvm/Support/Casting.h:237: typename
llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X =
clang::CXXDestructorDecl; Y = clang::NamedDecl; typename llvm::cast_retty<X,
Y*>::ret_type = clang::CXXDestructorDecl*]: Assertion `isa<X>(Val) &&
"cast<Ty>() argument of incompatible type!"' failed.

This bisects to:
commit 48fe699daa8509cf338f3c041ab486378cadb155
Author: Richard Smith <<a href="mailto:richard-llvm@metafoo.co.uk">richard-llvm@metafoo.co.uk</a>>
Date:   Mon Oct 10 18:54:32 2016 +0000

    Re-commit r283722, reverted in r283750, with a fix for a CUDA-specific use
of
    past-the-end iterator.

    Original commit message:

    P0035R4: Semantic analysis and code generation for C++17 overaligned
    allocation.


    git-svn-id: <a href="https://llvm.org/svn/llvm-project/cfe/trunk@283789">https://llvm.org/svn/llvm-project/cfe/trunk@283789</a>
91177308-0d34-0410-b5e6-96231b3b80d8</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>