Search

shared_ptr and lambda function crash with C1001 by 8Ika1oikXJA8H

Closed
as Fixed Help for as Fixed

1
0
Sign in
to vote
Type: Bug
ID: 706674
Opened: 11/20/2011 3:25:08 PM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
0
Workaround(s)
0
User(s) can reproduce this bug
#include <memory>
// this code generates a C1001
// but comment the line defining data and uncomment the line above and it compiles
// this construct is important for passing data when persistence is an issue in multithreading
//
int main()
{
    //typedef int data;
    struct data {};
    std::shared_ptr<data> p = std::shared_ptr<data>(new data);
    [=](){data& record = *p;};
    return 0;
}
Details (expand)

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

Visual Studio 2010

Steps to reproduce

#include <memory>
// this code generates a C1001
// but comment the line defining data and uncomment the line above and it compiles
// this construct is important for passing data when persistence is an issue in multithreading
//
int main()
{
    //typedef int data;
    struct data {};
    std::shared_ptr<data> p = std::shared_ptr<data>(new data);
    [=](){data& record = *p;};
    return 0;
}

Product Language

English

Operating System

Windows 7

Operating System Language

English

Actual results

1>------ Build started: Project: CRASH, Configuration: Release Win32 ------
1>Build started 20/11/2011 23:09:30.
1>ClCompile:
1> CRASH.cpp
1>CRASH.cpp(8): fatal error C1001: An internal error has occurred in the compiler.
1> (compiler file 'msc1.cpp', line 1420)
1> To work around this problem, try simplifying or changing the program near the locations listed above.
1> Please choose the Technical Support command on the Visual C++
1> Help menu, or open the Technical Support help file for more information
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:02.77
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Expected results

1>------ Build started: Project: CRASH, Configuration: Release Win32 ------
1>Build started 20/11/2011 23:24:28.
1>ClCompile:
1> CRASH.cpp
1>
1>Build succeeded.
1>
1>Time Elapsed 00:00:00.43
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 11/21/2011 at 11:10 AM
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-Moderator09 [Feedback Moderator] on 11/20/2011 at 7:24 PM
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 MS-Moderator01 on 11/20/2011 at 3:44 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.