Fatal Error C1509

compiler limit : too many exception handler states in function 'function'. simplify function

The code exceeds an internal limit on exception handler states (32,768 states).

The most common cause is that the function contains a complex expression of user-defined class variables and arithmetic operators.

To fix by using the following possible solutions

  1. Simplify expressions by assigning common subexpressions to temporary variables.

  2. Split the function into smaller functions.