Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

FIX: C2371, C2556, or C2511 error when you compile a Visual C++ project in Visual Studio 2012


View products that this article applies to.

Symptoms

Symptom 1

When you compile a Microsoft Visual C++ project that has an enumeration declaration at a specific offset, you may receive a C2371, C2556, or C2511 error.

Cause 1

This issue occurs because the compiler incorrectly parses enumeration declaration code that occurs at the end of a file buffer [at file offset (4096 * n)-1].

Symptom 2

You compile a Visual C++ project that has a virtual function call that returns an object and that binds the returned value to a reference. You also have the /clr option enabled. In this situation, you may receive an access violation exception at run time.

Cause 2

This issue occurs because the implicit lifetime extension of a temporary value that is bound to a const reference does not work if the following conditions are true:
  • The project is compiled as /clr.
  • The temporary value is the returned value of a virtual function call or a function call through a function pointer.

↑ Back to the top


Resolution

Hotfix information

A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing this specific problem.

If the hotfix is available for download, there is a "Hotfix Download Available" section at the top of this Knowledge Base article. If this section does not appear, submit a request to Microsoft Customer Service and Support to obtain the hotfix.

Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft website: Note The "Hotfix Download Available" form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language.

Prerequisites

To apply this hotfix, you must have Microsoft Visual Studio 2012 Update 4 installed.

Restart requirement

You may have to restart the computer after you install the hotfix if the affected files are not being used at the time of installation. We recommend that you close all Visual Studio 2012-related components before you install the hotfix.

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

↑ Back to the top


Keywords: kbautohotfix, kbqfe, kbhotfixserver, kbfix, kbsurveynew, kbexpertiseadvanced, kb

↑ Back to the top

Article Info
Article ID : 2929731
Revision : 1
Created on : 1/7/2017
Published on : 7/9/2014
Exists online : False
Views : 300