Search

VS2010 C++ Template Member Functions in Lambdas Error by Jason Meisel

Closed
as Fixed Help for as Fixed

2
0
Sign in
to vote
Type: Bug
ID: 718297
Opened: 1/12/2012 1:44:17 PM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
0
Workaround(s)
0
User(s) can reproduce this bug
Given a class with a templated member function, capturing "this" within a lambda function and trying to use the templated member function within it will result in odd errors. In a larger project I get error C2275 on the lines doing this. I have also created a small test case which gets error C2062.

However, both of these errors are fixed by explicitly calling the member function with "this->". That is, the implicit member function usage is what is broken.
Details (expand)

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

Visual Studio 2010 SP1

Steps to reproduce

Compile the attached test case "main.cpp".

Product Language

English

Operating System

Windows 7

Operating System Language

English

Actual results

main.cpp(14): error C2062: type 'int' unexpected

Expected results

Successful compile.
File Attachments
File Name Submitted By Submitted On File Size  
main.cpp 1/12/2012 310 bytes
Sign in to post a comment.
Posted by Microsoft on 1/13/2012 at 1:58 PM
Hi:
    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 1/12/2012 at 8:42 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 1/12/2012 at 2:43 PM
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.