I could not find the information where are exception class instances created during exception handling ? In which memory area (stack, heap, static storage, etc.) ? I assume it is not on the stack because of stack-unwinding ...
The answer is "in a mysterious area managed by the compiler" - seriously, the standard doesn't specify where they must be stored.
Exceptions are always thrown by value so no problem even if allocated on stack
From the standard:
15.2.4: The memory for the temporary copy of the exception being thrown is allocated in an unspecified way, except as noted in 3.7.3.1.
And 3.7.3.1 says:
3.7.3.1: All objects which neither have dynamic storage duration nor are local have static storage duration. The storage for these objects shall last for the duration of the program (3.6.2, 3.6.3).
Is kitchen quoted from the standard, it is unspecified. Most implementations allocate them from heap, as they need to survive the stack unwinding process, which may remove stack frames (when throwing outside a function) or create new ones (calling destructors etc). GCC uses built-in function __cxa_allocate_exception
for allocating the memory.