You can't throw a C++ exception from a hardware interrupt. The context is all wrong.
If you are running any kind of OS, you are constrained by what the OS allows interrupt routines to actually do.
For Linux the interrupt routine can (at least indirectly) raise a signal on the process, when the process is next scheduled the relevant signal handler will run, and you are allowed to use longjump() to exit the signal hander - so can effectively exit A().
If you don't have an OS, and don't allow any nested interrupts, and you know exactly what the interrupt stack frame looks like, you might manage to use some global variables to control when the ISR modifies its return address. This is only really likely to work if A() is assembler. I did use this trick to get a sub 1MHz 6809 reading double-density floppies (not enough clock cycles between data bytes to actually count the sector length).
If is probably safest to get the ISR to write to a memory location and check in A() for the value changing (make sure you use volatile).