Index: generic/tclCompile.c =================================================================== RCS file: /cvsroot/tcl/generic/tclCompile.c,v retrieving revision 1.17 diff -c -r1.17 tclCompile.c *** tclCompile.c 1999/10/21 02:16:22 1.17 --- tclCompile.c 1999/12/01 15:48:34 *************** *** 882,887 **** --- 882,896 ---- } else if (code == TCL_OUT_LINE_COMPILE) { /* do nothing */ } else { /* an error */ + + /* Since there was a compilation error, + * the last command did not get compiled + * into (*envPtr). We must decrement + * the number of commands claimed to be + * in (*envPtr). + */ + + envPtr->numCommands--; goto error; } } Index: tests/expr.test =================================================================== RCS file: /cvsroot/tcl/tests/expr.test,v retrieving revision 1.6 diff -c -r1.6 expr.test *** expr.test 1999/08/19 03:00:13 1.6 --- expr.test 1999/12/01 15:48:37 *************** *** 711,716 **** --- 711,719 ---- set a yellow expr 1?{$a}:0 } yellow + test expr-20.6 {handling of compile error in trial compile} { + list [catch {expr + {[incr]}} msg] $msg + } {1 {wrong # args: should be "incr varName ?increment?"}} # cleanup if {[info exists a]} {