[clang] Bug 17456 cast diagnostic
nathan at acm.org
Fri Jan 23 12:37:54 PST 2015
I think this is the remaining patch of mine waiting for review.
The original post is:
but I duplicate the description here. This updated patch fixes formatting, tabs
and tweaks the error text, but otherwise is the same as the earlier posting.
The patch addresses 17456, which is a desire for failed casts involving
classes to give better diagnostic. see http://llvm.org/bugs/show_bug.cgi?id=17456
Rather than a plain 'cannot cast' error, this patch changes things to:
1) for static cast from 'A *' to 'B *' where T & S are classes, give
'static_cast from 'A *' to unrelated hierarchy 'B *' is not allowed'
2) where a cast fails and involves incomplete classes (directly or as a
pointer), it also notes that the class is incomplete. For instance:
17456.cc:6:10: error: static_cast from 'A *' to unrelated hierarchy 'B *' is not
17456.cc:3:8: note: 'B' is incomplete
The test suite already had applicable cases, so this patch just adjusts those
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 5435 bytes
Desc: not available
More information about the cfe-commits