typesafe_cb: fix promotable types being incorrectly accepted by cast_if_type.
authorRusty Russell <rusty@rustcorp.com.au>
Fri, 11 Jun 2010 03:36:40 +0000 (13:06 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Fri, 11 Jun 2010 03:36:40 +0000 (13:06 +0930)
commit894dd68a8c899ca7b5028334804fa1638b583908
tree8b624566be769cc19834f81bd9969b36401b6d3f
parent5282308f19084f52e55c6c7cb12586d9e3c53532
typesafe_cb: fix promotable types being incorrectly accepted by cast_if_type.

cast_if_type() should not try to degrade the expression using 1?(test):0,
as that promotes bool to int, as well as degrading functions to function
pointers: it should be done by the callers.

In particular, this fixes sparse_bsearch.
ccan/typesafe_cb/test/compile_fail-cast_if_type-promotable.c [new file with mode: 0644]
ccan/typesafe_cb/test/compile_ok-typesafe_cb-vars.c [new file with mode: 0644]
ccan/typesafe_cb/typesafe_cb.h