Compiler Error C2382 with Standard Header File <system_error> in Visual C++ 2012 RC - by sunseraphic

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.


1
0
Sign in
to vote
ID 745967 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 6/1/2012 11:54:52 PM
Access Restriction Public

Description

Hi,

I am try to compile Clang on my windows 7 workstation with Visual C++ 11 in Visual Studio 2012 RC.

I met a error C2382 with standard header file system_error, so I investigate its source code and found:

// Line 155
const error_category& generic_category();
const error_category& iostream_category();
const error_category& system_category();

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

inline const error_category& iostream_category() _NOEXCEPT
	{	// get iostream_category
	return (_Error_objects<int>::_Iostream_object);
	}

inline const error_category& system_category() _NOEXCEPT
	{	// get system_category
	return (_Error_objects<int>::_System_object);
	}

where macro "_NOEXCEPT" was defined in yvals.h

// Line 18
#define _NOEXCEPT	throw ()

As it cames from Clang's clangCodeGen project, I inspected this project setting, and found that /Za option is ON!

That's said this case may be ignored with default configuration of  VC++ 2012 RC, but when you turn /Za option on, it would came out!

All above, hope you can fix this in RTM.

By the way, according to C++11 Standard, these function sould be defined like this:

ISO/IEC 14882:2011(E)
19.5.1 Class error_category [syserr.errcat]
19.5.1.1 Class error_category overview [syserr.errcat.overview]

const error_category& generic_category() noexcept;
const error_category& system_category() noexcept;

I don't know why VC++ did not support C++11 keyword "noexcept", but if you dont like introducing new keyword, I suggest that you may support a combined keyword with existed keyword, such as:

"do not throw while using this"

instead.

Just for fun : ), this joke is from here:
http://lists.boost.org/Archives/boost/2009/07/154074.php
Sign in to post a comment.
Posted by Microsoft on 6/5/2012 at 11:12 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 MS-Moderator01 on 6/2/2012 at 12: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)