Home Dashboard Directory Help

fatal error C1001 when using Lambda Expression by AntAgna2


 as Fixed Help for as Fixed

Sign in
to vote
Type: Bug
ID: 732006
Opened: 3/19/2012 10:14:45 AM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
User(s) can reproduce this bug


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 AntAgna2 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)
Sign in to post a workaround.
File Name Submitted By Submitted On File Size  
project.zip 3/19/2012 7 KB