MFC C++ fails to compile use of codecvt_utf8 in Debug Configuration - by DrK273

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 683483 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 8/9/2011 2:36:46 AM
Access Restriction Public


I wish to use codecvt_utf8 to write UTF-8 data to a std::wofstream file in a MFC C++ application.  Compiles and works OK in the Release configuration. Fails to compile in Debug configuration.

Workaround is to delete the following lines always added by the MFC project Wizard. However, I do not wish to do this in my large MFC application.

#ifdef _DEBUG
#define new DEBUG_NEW

It seems that the 'new' operator in std::codecvt_utf8 conflicts with the MFC 'DEBUG_NEW' operator.
Sign in to post a comment.
Posted by Microsoft on 1/6/2012 at 4:39 PM

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

According to the Standard, macroizing keywords when including Standard Library headers triggers undefined behavior, and VC11 will emit a hard #error when it detects this. However, macroizing "new" is unfortunately very common, so we've added special guards to all C++ Standard Library headers that will grant them immunity to macroized "new".

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

Stephan T. Lavavej
Visual C++ Libraries Developer
Posted by DrK273 on 9/15/2011 at 8:15 AM
It is over 5 weeks since I submitted this report and nearly 3 weeks since I asked for an update. Please provide an update as to the status of this issue?

Have you confirmed the issue?

Do you intend to fix it in this release of Visual Studio (2010)?
Posted by DrK273 on 8/29/2011 at 3:46 AM
Is there any update please?
Posted by MS-Moderator10 [Feedback Moderator] on 8/9/2011 at 7:11 PM
Thank you for submitting feedback on Visual Studio 2010 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 MS-Moderator01 on 8/9/2011 at 2:50 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(