This patch implements the smallest parts of DR195 that I think are
appropriate right now. DR195 is in drafting, but has been kicking around
for several years. The patch fixes the regressions caused by Mark's patch
for 14035 in the C++ testsuite.
The new testcase g++.dg/expr/cast2.C, still fails. It think it
should probably be removed as the testcase with this patch is doing
more complete checking. Also I changed g++.old-deja/g++.mike/p10148.C.
I couldn't really see the point of the c-cast there -- it was converting
the function pointer to a base (of the current class) pointer. I suspect
some parens might have been missed.
I've not documented the casts this patch permits, but will do so once
we've agreed on the desired semantics. Specifically, this patch permits
*) pointer-to-function to be explicitly converted to pointer-to-void,
provided there is no loss of precision.
*) pointer-to-void can be explicitly converted to pointer-to-function,
regardless of precision loss. The reason for a lack of precision check
here, is so one can convert a function-pointer to a void-pointer and back
again, so long as the void-pointer has at least as many bits.
DR195 does not single out pointer-to-void, but I consider void pointers
to be a reasonable restriction right now. We can always relax it later.