fatal error C1001 when using Lambda Expression - by AntAgna

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 732006 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 3/19/2012 10:14:45 AM
Access Restriction Public


This simple use of Lambda Expression makes the compiler crash (fatal error C1001) :
struct S { };
[] () { S s; };

I tried multiple variations but this is the simplest form that would cause this.
What triggers the bug is declaring a variable with a type that is locally declared (in the same function)
It compiles properly when S is defined globally (before _tmain)

The code as is compiles properly with g++
Sign in to post a comment.
Posted by Microsoft on 3/20/2012 at 10:41 AM
    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-Moderator10 [Feedback Moderator] on 3/19/2012 at 11:21 PM
Thank you for reporting the issue.
We are routing 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 AntAgna on 3/19/2012 at 11:06 AM
With a simple project, this is the message given :
fatal error C1001: An internal error has occurred in the compiler.
(compiler file 'msc1.cpp', line 1420)

When adding the same two lines of code to my main codebase (which I can't share), the error message when compiling is slightly different :
(compiler file 'f:\dd\vctools\compiler\cxxfe\sl\p1\c\main.c', line 2473)
Posted by MS-Moderator01 on 3/19/2012 at 10:45 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)