There is one thing one should remember about the "as if rule": it doesn't exist as such, in C, C++, Java or high level languages in general.
There are rules about the identifiers: what they can contain, what they must start with, what they can't be (reserved words). There are rules about grammar. About overflow.
And each of these rules could have been different, these rules aren't exactly the same in other programming languages (compare overflow in Java and in C++). The so called as if rule is different at the meta level, as such it isn't a rule but an observation. It's a comment and it cannot be removed from the C++ standard or any language specification because it isn't a rule of the specification, it describes what the specification is.
As if you wrote in a printed book "this book is printed with ink" and later removed the mention, the book would still have nearly as much ink. Or if you added to the C++ specification "this specification is written in English" and later removed the mention, the rest would still be in English.]
What people call a "rule" is a reminder of the essence of the description of the programming language standard.
You can only apply the so called as if "rule" to a complete well formed, compilable program; there is no as if rule for statements or expressions.
The semantics of each statement, subexpression, etc. is described by language semantics; applied to a whole, complete, valid program, the semantics defines the set of possible outputs of a program.
If you have a program that can run, the "rule" just says that conformance is defined by measuring the program I/O (including volatile access, which is a kind of I/O just like stdio, and returning from main
/calling exit
).
Summary: your question as such is meaningless and you should forget there is something called "as if rule", because it can't be made into a distinct, removable rule.
NOTE
The value of the expression throw 42;
is not used, and it doesn't
satisfy any of the criteria of being a side-effect.
Because a throw expression throws an exception, it doesn't result in a "value" like the 42 part. It has an effect: its throws the exception, to stop normal control flow and jump to an exception handler or exit the program completely if none is present.
In term of "abstract machine", throwing certainly does something: it stops the usual execution in the abstract machine. In the abstract machine, you can see the effect of a throw.
Asking about "abstract machine" seems to contradict your whole point as any computation is visible in the abstract machine, but the abstract machine is not visible.
Anyway, all these dissertations only prove my point that "abstract machine", "as if rule"... are noxious concepts that don't help anyone.
Just consider program semantics, which is always defined in term of I/O in all high level languages. Forget the rest!