Function pointers and member function pointers cannot be converted to void*. libc++abi incorrectly allows this conversion for function pointers.
I also flushed out some of the pointer to member function conversion tests.
Differential D8811
[libc++abi] Disallow conversions from function pointers to void*. EricWF on Apr 2 2015, 4:56 PM. Authored by
Details
Function pointers and member function pointers cannot be converted to void*. libc++abi incorrectly allows this conversion for function pointers. I also flushed out some of the pointer to member function conversion tests.
Diff Detail Event Timeline
Comment Actions What confuses you about that output? The patch says that a pointer type whose pointee type is 'void' cannot catch a pointer-to-function; this appears to be a correct change to me. Comment Actions I expect that output. I'm confused by the patch because I don't understand how a thrown pointer-to-function could result in is_equal(__pointee, &typeid(void), false)) being true... pointer-to-function's typeid is different than void's (the example output was meant to show that). What causes control to enter the 'then' side of that if in that case?
Comment Actions Urgent ping! I think this fix should go into 3.6.1 so I would like to land it. I addressed @majnemer's comments in another patch. I removed the (incorrect) tests that were not related to this fix. |
Why would a function pointer have the same typeid as void?
Is it clang that's getting this wrong? Do your new tests pass with GCC as the compiler, but this change reverted?