<br><br><div class="gmail_quote">Le 17 novembre 2011 01:14, Richard Trieu <span dir="ltr"><<a href="mailto:rtrieu@google.com">rtrieu@google.com</a>></span> a écrit :<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5"><div class="gmail_quote">On Wed, Nov 16, 2011 at 12:06 PM, Matthieu Monrocq <span dir="ltr"><<a href="mailto:matthieu.monrocq@gmail.com" target="_blank">matthieu.monrocq@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br><br><div class="gmail_quote">Le 15 novembre 2011 21:23, Richard Trieu <span dir="ltr"><<a href="mailto:rtrieu@google.com" target="_blank">rtrieu@google.com</a>></span> a écrit :<div><div><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


New feature that will print additional information when non-matching function pointers are used.  This will help users more easily distinguish why the function pointers do not match.  The points of difference that will be noted are:<div>



<br></div><div>Different number of parameters</div><div>Different parameter type</div><div>Different return type</div><div>Different function qualifiers</div><div><br></div><div>For instance, code like this:</div><div><br>



</div><div><div>double foo(int x) {return 0;};</div><div>double (*bar)(int, int) = &foo;</div></div><div><br></div><div>Will get this error message:</div><div><br></div><div><div>function-mismatch.cc:2:10: error: cannot initialize a variable of</div>



<div>      type 'double (*)(int, int)' with an rvalue of type 'double (*)(int)'</div><div>      because of different number of parameters (expected 2 but has 1)</div><div>double (*bar)(int, int) = &foo;</div>



<div>         ^                ~~~~</div></div><div><br></div><div>Patch is attached and also available at <a href="http://codereview.appspot.com/5369119/" target="_blank">http://codereview.appspot.com/5369119/</a></div>



<br><br></blockquote></div></div><div>Nice!<br><br>Do you plan on adding something for a difference of class (for pointer to member functions) ? Or perhaps that it already exists...<span><font color="#888888"><br>
<br>-- Matthieu<br></font></span></div></div><br>
</blockquote></div></div></div>Added a bit to the diagnostic message to say if they are from different classes, as well as changes in response to comments Richard Smith made on <a href="http://codereview.appspot.com/5369119/" target="_blank">http://codereview.appspot.com/5369119/</a>
</blockquote></div><br>Thanks!<br><br>-- Matthieu<br>