[llvm-bugs] [Bug 33168] New: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed with template destructor error

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 25 07:58:59 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33168

            Bug ID: 33168
           Summary: Assertion `isa<X>(Val) && "cast<Ty>() argument of
                    incompatible type!"' failed with template destructor
                    error
           Product: clang
           Version: 4.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: russell_gallop at sn.scee.net
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

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 <richard-llvm at metafoo.co.uk>
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: https://llvm.org/svn/llvm-project/cfe/trunk@283789
91177308-0d34-0410-b5e6-96231b3b80d8

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170525/8fc87775/attachment.html>


More information about the llvm-bugs mailing list