Home Dashboard Directory Help
Search

Function pointers incorrectly convertible to void* by Peter Dimov


Status: 

Closed
 as By Design Help for as By Design


2
0
Sign in
to vote
Type: Bug
ID: 425547
Opened: 3/20/2009 10:33:00 AM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

Function pointers are not convertible to void* according to C++03 4.10/2 since functions are not objects (1.8/1). But Microsoft Visual C++ does allow the conversion. This is not a pure extension because it breaks overload resolution.
Details
Sign in to post a comment.
Posted by Peter Dimov on 3/23/2009 at 10:49 AM
Hi,

I don't mind the conversion per se; I understand that these extensions are needed for legacy code. But it does break conforming code examples such as the one I posted. Maybe this implicit conversion should have the lowest possible rank so that it is only used as a last resort?
Posted by Microsoft on 3/23/2009 at 10:31 AM
Hi Peter: If you compile with /Za you'll see that we do in fact get this right - though in the more usual "relaxed" mode we do allow a function pointer to convert to void*.

Jonathan Caves
Visual C++ Compiler Team
Posted by Microsoft on 3/22/2009 at 8:11 PM
Thanks for your feedback.

We are escalating this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.

Thank you,
Visual Studio Product Team
Sign in to post a workaround.