Search

C++ compiler loses member-ness of pointer-to-member-function during template deduction, causes ICE by Ben Voigt

Closed
as Fixed Help for as Fixed

4
0
Sign in
to vote
Type: Bug
ID: 678295
Opened: 7/4/2011 8:47:20 AM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
0
Workaround(s)
0
User(s) can reproduce this bug
Somehow the compiler thinks the type of a pointer-to-member-function is `void (__cdecl *)(const int &)`, which is an ordinary function pointer type. Then it fails to match the correctly-defined formal parameter type.
Details (expand)

Visual Studio/Team Foundation Server/.NET Framework Tooling version

Visual Studio 2010 SP1

Steps to reproduce

Compile code from http://ideone.com/XJ7of

Product Language

English

Operating System

Windows 7

Operating System Language

English

Actual results

ideone_XJ7of.cpp(35) : error C2784: 'identity<T> match_memfn_classtype(void (__thiscall T::* )(Arg))' : could not deduce template argument for 'void (__thiscall T::* )(Arg)' from 'void (__cdecl *)(const int &)'

ideone_XJ7of.cpp(19) : see declaration of 'match_memfn_classtype'

ideone_XJ7of.cpp(35) : error C2784: 'identity<T> match_memfn_argtype(void (__thiscall T::* )(Arg))' : could not deduce template argument for 'void (__thiscall T::* )(Arg)' from 'void (__cdecl *)(const int &)'

ideone_XJ7of.cpp(22) : see declaration of 'match_memfn_argtype'

ideone_XJ7of.cpp(35) : fatal error C1903: unable to recover from previous error(s); stopping compilation

c1xx : fatal error C1063: INTERNAL COMPILER ERROR
         Please choose the Technical Support command on the Visual C++
         Help menu, or open the Technical Support help file for more information

Expected results

Compiles (like Comeau and gcc do) and generates the following output when run:

getter used
c.myInt = 5
setter used
getter used
c.myInt = -1
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 7/11/2011 at 2:29 PM
Hi Ben:
    A fix for this issue has been checked into the compiler sources. The fix should show up in the next release of Visual C++.

Xiang Fan
Visual C++ Team
Posted by MS-Moderator07 [Feedback Moderator] on 7/4/2011 at 6:30 PM
Thanks for your feedback.

We are rerouting 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.
Posted by MS-Moderator01 on 7/4/2011 at 8:49 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.