throw expressions (C++ only)

You use a throw expression to indicate that your program has encountered an exception.

Read syntax diagramSkip visual syntax diagramthrow expression syntax
 
>>-throw--+-----------------------+----------------------------><
          '-assignment_expression-'
 

The type of assignment_expression cannot be an incomplete type, or a pointer to an incomplete type other than one of the following:

The assignment_expression is treated the same way as a function argument in a call or the operand of a return statement.

If the assignment_expression is a class object, the copy constructor and destructor of that object must be accessible. For example, you cannot throw a class object that has its copy constructor declared as private.

Related information