Visual C++ 2013 RC system_category().equivalent function does not work - by Egtra

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 800821 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 9/15/2013 9:23:49 AM
Access Restriction Public


Please compile and run following source code:
#include <iostream>
#include <string>
#include <system_error>
#include <windows.h>

int main()
  std::error_code ec(ERROR_NOT_ENOUGH_MEMORY, std::system_category());
  std::cout << std::boolalpha;
  std::cout << (ec == std::make_error_condition(std::errc::not_enough_memory)) << std::endl; // (1)
  std::cout << std::system_category().equivalent(ERROR_NOT_ENOUGH_MEMORY, std::make_error_condition(std::errc::not_enough_memory)) << std::endl; // (2)
  std::cout << (boost::system::system_category().default_error_condition(ERROR_NOT_ENOUGH_MEMORY) == make_error_condition(boost::system::errc::not_enough_memory)) << std::endl; // (3)

I expect that all expressions (1), (2), and (3) are true. But actual results are false.

I read "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\system_error".
It seems that std::_System_error_category::default_condition is not implemented.
I expect that std::_System_error_category::default_conditionis mapping Win32 error code to std::errc generic error code.

Thank you.
Sign in to post a comment.
Posted by Microsoft on 7/30/2014 at 4:10 PM

Thanks for reporting this bug. We've fixed it, and the fix will be available in VS14 RTM (planned for release in 2015). The fix may appear in preview releases between now and RTM (depending on the exact timing of branch merges, so I can't be more specific at this moment).

We had logic that attempted to map between Windows and Posix error codes, but it was broken. We've fixed it so it conforms to the Standard.

Stephan T. Lavavej
Senior Developer - Visual C++ Libraries
Posted by Microsoft on 9/16/2013 at 4:30 AM
Thank you for submitting feedback on Visual Studio 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 Microsoft on 9/15/2013 at 9:55 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(