There was a lot of discussion of C++ aliasing rules at the recent
meeting; we really seem to be moving in the direction of being stricter
about which union member is active. So I think we do want to diagnose
the new-expression above; the user should write new (&u) if that's what
they mean.
Okay. I changed that in the latest patch.
Adjust is negative when the offset to a buffer of known size is
negative. For example:
char buf [sizeof (int)];
new (&buf [1] - 1) int;
OK, so because we're looking at the expression from the outside in, we
first see the subtraction and adjust becomes -1, then we see the
array_ref and adjust returns to 0. We still don't have a negative
adjust by the time we get to the quoted if/else.
I think I see what you mean. I've changed the type of the variables
and the computation to unsigned. That made it possible to eliminate
the final else and do some other cleanup. Attached is an updated
patch.