[LLVMbugs] [Bug 17632] New: Assertion with -Wconsumed: isa<X>(Val) && "cast<Ty>() argument of incompatible type!"

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Oct 21 05:27:47 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=17632

            Bug ID: 17632
           Summary: Assertion with -Wconsumed: isa<X>(Val) && "cast<Ty>()
                    argument of incompatible type!"
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jonathan.sauer at gmx.de
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 11397
  --> http://llvm.org/bugs/attachment.cgi?id=11397&action=edit
Complete log of clang run

The following code crashes clang r193073 when compiled with -Wconsumed:

template <typename String_>
struct Foo {
    explicit Foo(String_) {}
};


int main()
{
    const char*         bar = "bar";
    Foo<const char*&>   foo(bar);
}


This results in (full log attached):

% ~/LLVM/build/Release+Asserts/bin/clang++ -Wconsumed clang.cpp
Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"),
function cast, file /Users/rynnsauer/LLVM/llvm/include/llvm/Support/Casting.h,
line 232.
[...]
clang::consumed::ConsumedStmtVisitor::VisitParmVarDecl(clang::ParmVarDecl
const*) + 702


The code compiles successfully with clang r192096. It also compiles
successfully with r193073 when not passing -Wconsumed.

It also compiles successfully with r193073 when making Foo's template parameter
a non-reference type:

template <typename String_>
struct Foo {
    explicit Foo(String_) {}
};


int main()
{
    const char*        bar = "bar";
    Foo<const char*>   foo(bar);
    //             ^ removed '&'
}

-- 
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/20131021/a7dbff6b/attachment.html>


More information about the llvm-bugs mailing list