Search

illegal use of local type in template instantiation by Sai Jagannath

Closed
as Fixed Help for as Fixed

1
0
Sign in
to vote
Type: Bug
ID: 714524
Opened: 12/18/2011 7:30:56 AM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
0
Workaround(s)
0
User(s) can reproduce this bug
Hi,
The code below does not compile.

std::vector<int> ints;
std::map<int, int> m;

std::for_each(ints.begin(), ints.end(), [&m](int x)
{
    ++m[x];
});

It compiles in g++4.6.1. Is this a bug in VC11 ?

-Jagannath.

Details (expand)

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

Visual Studio 11 Developer Preview

Steps to reproduce

std::map<int, int> m;

std::for_each(ints.begin(), ints.end(), [&m](int x)
{
    ++m[x];
});

Product Language

English

Operating System

Windows 7

Operating System Language

English (US)

Actual results

Code does not compile.

Expected results

Code should compile.
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 1/9/2012 at 4:36 PM
Hi: this issue has been fixed. The fix should show up in a future release of Visual C++.

Thank you for reporting the issue.

Jonathan Caves
Visual C++ Compiler Team
Posted by Microsoft on 12/22/2011 at 1:54 AM
Thank you for submitting feedback on Visual Studio 2010 and .NET Framework. Your issue has been routed to the appropriate VS development team for review. We will contact you if we require any additional information.
Posted by Sai Jagannath on 12/21/2011 at 5:10 AM
With "Disable Language Extensions" set to Yes, the above code fails to compile. If set to No, then the code compiles.


Thanks.
Jagannath.
Posted by Microsoft on 12/20/2011 at 11:57 PM
Additionally, please provide us with a screenshot to show the error results.
Posted by MS-Moderator09 [Feedback Moderator] on 12/19/2011 at 1:04 AM
Thank you for reporting this issue. In order to research the issue reported, we must first reproduce in our labs. Unfortunately, we are unable to reproduce the issue with the steps you provided.

Could you please provide us with a sample project zip for further investigating?

It would be greatly appreciated if you could provide us this information as quickly as possible.

Thank you
Posted by MS-Moderator01 on 12/18/2011 at 7:42 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.