Search

/Za (disable extensions) disables template arguments with local linkage, which is a C++11 feature. by Bigcheesegs

Closed
as Fixed Help for as Fixed

1
0
Sign in
to vote
Type: Bug
ID: 734791
Opened: 3/30/2012 4:06:08 PM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
1
Workaround(s)
0
User(s) can reproduce this bug
Compiling C++11 code with /Za disables standard C++11 features.
Details (expand)

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

Visual Studio 11 Beta

Steps to reproduce

Compile with /Za

#include <functional>

int main() {
std::function<bool()> a = []{return true;};
}

Product Language

English

Operating System

Windows 7

Operating System Language

English

Actual results

vs11-local-type.cpp(4) : error C2918: 'main::<lambda_63682f0b76fdab45467a1287b25f25ed>' : illegal use of local type in template instantiation
vs11-local-type.cpp(4) : error C2440: 'initializing' : cannot convert from 'main::<lambda_63682f0b76fdab45467a1287b25f25ed>' to 'std::function<_Fty>'
        with
        [
            _Fty=bool (void)
        ]
        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

Expected results

Successfully compile.
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 4/2/2012 at 10:07 AM
Thank you for reporting this issue to Microsoft. It has already been fixed.

Tanveer Gani
Visual C++ Team.
Posted by MS-Moderator09 [Feedback Moderator] on 4/1/2012 at 8:13 PM
Thank you for submitting feedback on Visual Studio 11 and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by MS-Moderator01 on 3/30/2012 at 4:51 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.
Posted by Bigcheesegs on 3/30/2012 at 4:07 PM
The trivial workaround is to not use /Za, but this makes it harder to write portable code.