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

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 745643 Comments
Status Closed Workarounds
Type Bug Repros 1
Opened 6/1/2012 3:55:24 AM
Access Restriction Public


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.
Sign in to post a comment.
Posted by Microsoft on 6/4/2012 at 6:42 PM

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 .

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(