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.