Search

<system_error>: error C2382 when compiling with '/Za' (Disable Language Extensions) by zchothia

Closed
as Fixed Help for as Fixed

1
0
Sign in
to vote
Type: Bug
ID: 745614
Opened: 6/1/2012 2:37:28 AM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
A program which is compiled with the '/Za' flag and includes the <system_error> header fails to compile with VS2012.

This issue seems to be caused by a mismatch between the prototype and declaration of the functions 'generic_category', 'iostream_category' and 'system_category' with respect to the _NOEXCEPT specifier.
Details (expand)

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

Visual Studio 2012 RC

Steps to reproduce

Create a file 'test.cpp' with the following contents.

    #include <system_error>

    int main() {
     return 0;
    }

Compile with the command 'cl /Za test.cpp'

Product Language

English

Operating System

Windows 7

Operating System Language

English

Actual results

Program fails to compile with VS2012 RC (version 17.00.50522.1) with the following errors:

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\system_error(669) : error C2382: 'std::generic_category' : redefinition; different exception specifications
        C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\system_error(155) : see declaration of 'std::generic_category'
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\system_error(674) : error C2382: 'std::iostream_category' : redefinition; different exception specifications
        C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\system_error(156) : see declaration of 'std::iostream_category'
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\system_error(679) : error C2382: 'std::system_category' : redefinition; different exception specifications
        C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\system_error(157) : see declaration of 'std::system_category'

Expected results

The same program compiles successfully with VS2010 (version 16.00.40219.01).
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 6/4/2012 at 4:42 PM
Hi,

Thanks for reporting this bug. We've already fixed it, and the fix will be available in VC11 RTM.

Please note that /Za is buggy and breaks conformant code, such as vector<unique_ptr<T>>. As a result, we recommend against using /Za, and we stopped testing the STL with it during VC10's development.

If you have any further questions, feel free to E-mail me at stl@microsoft.com .

Stephan T. Lavavej
Visual C++ Libraries Developer
Posted by Microsoft on 6/3/2012 at 8:54 PM
Thanks for your feedback.

We are rerouting 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 MS-Moderator01 on 6/1/2012 at 2:43 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.