[clang 17456] reference cast diagnostic for unrelated classes
Nathan Sidwell
nathan at acm.org
Fri Feb 6 13:44:14 PST 2015
Richard,
here's the reference-cast case of the unrelated hierarchy patch I recently
created for ptr-to-class (http://llvm.org/bugs/show_bug.cgi?id=17456). I had a
bit of a struggle coming up with a nicely worded diagnostic. This now produces:
17456-2.cc:6:10: error: non-const lvalue reference to class 'B' cannot bind to a
value of class 'A', which is not related by inheritance
return static_cast<B&>(arg);
^ ~~~
when the src and target reference types are classes. It also notes if either is
incomplete.
ok?
nathan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 17456-4.patch
Type: text/x-patch
Size: 8653 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150206/bde7266a/attachment.bin>
More information about the cfe-commits
mailing list