[clang 17456] reference cast diagnostic for unrelated classes

Nathan Sidwell nathan at acm.org
Fri Feb 27 06:50:15 PST 2015


Ping?

On 02/06/15 16:44, Nathan Sidwell wrote:
> 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/20150227/62b52fde/attachment.bin>


More information about the cfe-commits mailing list