Commenting out that line makes the error disappear. From what I've understood from Effective C++, calling delete on an uninitialized or NULL pointer should not be harmful, so I've ruled the preceding line from causing errors.
Can anybody explain why the NULL assignment is causing that error? Is there some rule about pointer assignment during exceptions? Calling the destructor normally in a non-throwing situation doesn't cause the segfault, so I'm kind of confused now.
Are you sure that it is the case? Because nothing should call your destructor in code you provided
If B class constructor throws an exception, assigment to myClass variable will never happen and it will still contain a null pointer. Deleting a null pointer is a no-op by Standard.