wrote:
> 1. Why does the compiler balk about inaccessibility of a function (the
> copy constructor) it does not use?
Because the standard requires the copy constructor to be accessible
even though it specifically allows the compiler to skip calling it.
There's a much simpler situation with the same requirements: Suppose
that you have a class named MyClass with a constructor which takes an
int. If you do this:
MyClass obj = 5;
then the copy constructor of MyClass must be accessible even though the
compiler is allowed to never call it. Test it if you like.
> 2. Why *is* it not using the copy constructor? I would have expected
> to see the exception object copy constructed / destructed at each
> level of the call stack as that stack is unwound.
The compiler is allowed to optimize copy constructor calls away if it
can, even in situations where it should "logically" be called. The
standard specifically gives this permission. In this particular
situation the compiler uses some smart optimization to avoid useless
copy constructor calls.