Search

error C2382 on "std::generic_category", "std::iostream_category", "std::system_category" by Minjang Kim

Closed
as Fixed Help for as Fixed

2
0
Sign in
to vote
Type: Bug
ID: 745643
Opened: 6/1/2012 3:55:24 AM
Access Restriction: Public
1
Workaround(s)
1
User(s) can reproduce this bug
I was compiling a big open source project with VS 2012 RC with the 64-bit C++ compiler. It was okay with VS 2012 Beta and VS 2010. But, now I'm getting these errors:


22>Z:\VS11\VC\include\system_error(669): error C2382: 'std::generic_category' : redefinition; different exception specifications (D:\dev\llvm-3.1.src\tools\clang\lib\Basic\VersionTuple.cpp)
22>         Z:\VS11\VC\include\system_error(155) : see declaration of 'std::generic_category'

22>Z:\VS11\VC\include\system_error(674): error C2382: 'std::iostream_category' : redefinition; different exception specifications (D:\dev\llvm-3.1.src\tools\clang\lib\Basic\VersionTuple.cpp)
22>         Z:\VS11\VC\include\system_error(156) : see declaration of 'std::iostream_category'

22>Z:\VS11\VC\include\system_error(679): error C2382: 'std::system_category' : redefinition; different exception specifications (D:\dev\llvm-3.1.src\tools\clang\lib\Basic\VersionTuple.cpp)
22>         Z:\VS11\VC\include\system_error(157) : see declaration of 'std::system_category'


The problem is because the declarations of three functions in <system_error> don't have _NOEXCEPT:

155: const error_category& generic_category();
156: const error_category& iostream_category();
157: const error_category& system_category();


However, for example, generic_category's definition has _NOEXCEPT:

668: inline const error_category& generic_category() _NOEXCEPT
669:    {    // get generic_category
670:    return (_Error_objects<int>::_Generic_object);
671:    }



Either inserting _NOEXCEPT or removing _NOEXCEPT on these three functions resolve the problem. Again, this problem was not existing in the beta version.
Details (expand)

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

Visual Studio 2012 RC

Steps to reproduce

I was using VS 2012 RC to compile LLVM and Clang version 3.1 with the 64-bit compiler. The solution file was generated by CMake.

http://llvm.org/releases/3.1/llvm-3.1.src.tar.gz
http://llvm.org/releases/3.1/clang-3.1.src.tar.gz

Then, compile the solution. You will see these compile errors.

Product Language

English

Operating System

Windows 7

Operating System Language

English

Actual results

Compiler errors

Expected results

Compiler errors
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 6/4/2012 at 6: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 (the compiler option you're using that exposed this bug) 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 MS-Moderator01 on 6/1/2012 at 4:42 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.
Posted by Minjang Kim on 6/1/2012 at 3:56 AM
Current my workaround is inserting "_NOEXCEPT" on the declarations of "std::generic_category", "std::iostream_category", "std::system_category".