[PATCH] Fix diagnostics for C-style cast to function type
Logan Chien
tzuhsiang.chien at gmail.com
Thu Mar 27 09:51:39 PDT 2014
Ping?
On Mon, Mar 17, 2014 at 11:59 PM, Logan Chien <tzuhsiang.chien at gmail.com>wrote:
> Hi,
>
> It seems that if the C-style type cast is applied to the overloaded
> function and the destination type is function type, then Clang will crash
> with assertion failure. For example,
>
> void foo(int);
> void foo(int, int);
> void bar() {
> typedef void (ft)(int);
> ft p = (ft)foo;
> }
>
> In this case, the overloaded function foo will be cast to a function type,
> which should be considered as an error. But, unfortunately, since the
> function resolution is using canonical type, the matched function will be
> returned, and raise SEGV at lib/Sema/SemaCast.cpp:2101.
>
> This patch fixes this issue by removing the assertion and add some error
> diagnostics as the one in static_cast. Please have a look. Thanks.
>
> Logan
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140328/8986f374/attachment.html>
More information about the cfe-commits
mailing list