<div dir="ltr"><div>Hi,<br><br>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,<br></div> <br>
void foo(int);<br> void foo(int, int);<br> void bar() {<br> typedef void (ft)(int);<br> ft p = (ft)foo;<br> }<br> <br>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.<br>
<br>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.<br><br>Logan<br></div>