The information in this article applies to:
SYMPTOMSUsing /O1 (minimize size) or /O2 (maximize speed) causes a C1001 error in a try block with the following error message: Additionally, C++ exception handling must be enabled (/GX). If the warning level is set to 4 (/W4), C4702 (unreachable code) warnings are issued before the C1001 fatal error. CAUSEThe cause of the problem is having both /Og (global optimizations) and inline function expansion /Ob1 (Only __inline) or /Ob2 (Any Suitable) compiling. /O1 and /O2 are both compound switches, including /Og and /Ob1. RESOLUTIONDisable either global optimizations (/Og-) or inline function expansion (/Ob1- or /Ob2-). Please see the More Information section below. STATUSMicrosoft has confirmed this to be bug in the Microsoft products listed at the beginning of this article. This bug was corrected in Visual C++ 32-bit Edition version 4.2. MORE INFORMATIONThe following code reproduces the error when compiled:
The following error message is generated:
Compiling from command line with both /Og (global optimizations) and in-line function expansion, /Ob1(Only __inline) or /Ob2 (Any Suitable), reproduces the error. For instance, using:
Compiling with the following switch settings in command line does not
produce errors:
- or -
One workaround when using /O1 or /O2 in Developer Studio is to disable
In-line function expansion (Build:Settings, C++ Tab, Optimizations
category). Another workaround is to disable global optimizations. To
accomplish this, choose Custom for the type of optimization
(Build:Settings, C++ Tab, Optimizations category). Check all categories
that apply, but do not check global optimizations. This behavior is similar
to using the components of /O1 or /O2 and eliminating /Og). An additional
method is to leave /O1 or /O2 intact and manually add /Og- to the Project
Options.
Additional query words: kbVC400bug 4.00 4.10 4.20 vcfixlist420 CPPIss
Keywords : kbCompiler kbCPPonly kbVC |
Last Reviewed: September 10, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |