Just a note regarding these:
/home/mast/Pike/no-changes-7.7/src/testsuite.in:11: Test 9 (shift 0) (CRNL) failed (expected eval error). Got 0 1: mixed a() { (string) ({0x80000000}); } 2:
/home/mast/Pike/no-changes-7.7/src/testsuite.in:13: Test 11 (shift 2) (CRNL) failed (expected eval error). Got 0 1: mixed a() { (string) ({-0x80000001}); } 2:
The problem here is not the casting or that it doesn't throw an error as it should, but rather that the optimizer or pike_test.pike or something makes the error disappear.
Ah, it's of course the optimizer that is a bit too eager to get rid of side effect free void expressions:
lambda () {1 / 0;}();
(1) Result: 0
lambda () {return 1 / 0;}();
Division by zero. Unknown program: `/(1,0) HilfeInput:1: HilfeInput()->__lambda_65738_0_line_1()
So the proper way to ascertain that something gets side effects run is something like this, instead?
lambda(mixed x){}(1/0);
If not, how about adding something like a method assert() (under some other name, perhaps) which does ascertains that whatever expressions passed don't get optimised away, or some kind of optimiser override, for the rare case where you don't care storing something, but want a validation / error throwing side effect of evaluating some code with no other side effects?
I think the optimizer should simply evaluate the constant compile time (just as it does with all other constants) and remove it only if the evaluation succeeds. Optimizations should really be side-effects free (except for time and space).
pike-devel@lists.lysator.liu.se