[LLVMbugs] [Bug 17456] New: Error message 'static_cast from 'A *' to 'B *' is not allowed' could probably be more detailed

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 2 16:09:55 PDT 2013


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

            Bug ID: 17456
           Summary: Error message 'static_cast from 'A *' to 'B *' is not
                    allowed' could probably be more detailed
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dcheng at google.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Example:
cat > a.h << EOF
class A {
};
EOF

cat > b.h << EOF
class B : public A {
};
EOF

cat > c.cc << EOF
#include "a.h"

class B;

void Foo(A* always_a_b) {
  B* b = static_cast<B*>(always_a_b);
}
EOF

clang -I. -o c.o c.cc

In this case, I think Clang could be more helpful by describing why the static
cast is not allowed (B is only forward declared and not fully defined).

-- 
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/20131002/9b94010a/attachment.html>


More information about the llvm-bugs mailing list