[...]
AFAICS that's right, there's a missing formal guarantee.
Then how are you sure
? It looks more to me as if you're
taking your desires for reality.
What's missing is a definition of built-in = in terms of a
built-in operator= function.
That's a generality with regards to operators. The built-in
operators do NOT generally create a sequence point. User
defined operators always do, because they are functions, and
calling a function creates a sequence point.
Regarded as a function, it's clear that the arguments are fully
evaluated before the function is called.
*Because* calling a function creates a sequence point.
Otherwise: an expression has a value and side effects. What the
standard guarantees is that the value is evaluated before it is
used, and that the side effects will not occur before any
previous sequence point, nor after any following sequence point.
The only ordering guarantees concerning side effects involves
sequence points.
No, I don't think doing anything in-practice is a solution to
a purely formal problem, and absolutely not obvious.
Is the problem purely formal? I originally believed that the
intent of the standard was probably to guarantee this, and that
the authors simply forgot to consider the case. On rereading
the clauses, however, I see that the possibility of a new
expression being interrupted by an exception definitly was
considered, so I'm beginning to think that the intent was to
leave this undefined. And if that was the intent, it's probable
that somewere, some compiler exploits this liberty.
More to the point, of course: this isn't really the way
exceptions were meant to be used. What I'd really expect to
see, in good code, is something like:
try {
C* c = new C( ... ) ;
// use c here...
} catch ...
If the code is more complicated, then it probably belongs in a
separate function, something like:
C*
createC( ... )
{
try {
return new C( ... ) ;
} catch ( E& e ) {
// ...
return NULL ;
}
}