Edit

Share via


Compiler Warning (level 1) C4532

'continue' : jump out of __finally/finally block has undefined behavior during termination handling

Remarks

The compiler encountered one of the following keywords:

causing a jump out of a __finally or finally block during abnormal termination.

If an exception occurs, and while the stack is being unwound during execution of the termination handlers (the __finally or finally blocks), and your code jumps out of a __finally block before the __finally block ends, the behavior is undefined. Control may not return to the unwinding code, so the exception may not be handled properly.

If you must jump out of a __finally block, check for abnormal termination first.

The /sdl (Enable Additional Security Checks) compiler option elevates this warning to an error.

Example

The following sample generates C4532; delete or comment out the jump statements to resolve the warnings.

// C4532.cpp
// compile with: /W1
// C4532 expected
int main() {
   int i;
   for (i = 0; i < 10; i++) {
      __try {
      } __finally {
         // Delete the following line to resolve.
         continue;
      }

      __try {
      } __finally {
         // Delete the following line to resolve.
         break;
      }
   }
}