about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Src/exec.c2
-rw-r--r--Test/A01grammar.ztst12
2 files changed, 13 insertions, 1 deletions
diff --git a/Src/exec.c b/Src/exec.c
index a1059af5e..7001fd615 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1961,7 +1961,7 @@ execpline(Estate state, wordcode slcode, int how, int last1)
 	}
 	else
 	    unqueue_signals();
-	if ((slflags & WC_SUBLIST_NOT) && !errflag)
+	if ((slflags & WC_SUBLIST_NOT) && !errflag && !retflag)
 	    lastval = !lastval;
     }
     if (!pline_level)
diff --git a/Test/A01grammar.ztst b/Test/A01grammar.ztst
index 0312fe94e..b3aea1055 100644
--- a/Test/A01grammar.ztst
+++ b/Test/A01grammar.ztst
@@ -970,3 +970,15 @@ F:its expectations.
 0:Non-interactive shell command input is line buffered
 >Value is first
 >Value is second
+
+ fn() {
+   ! false
+ }
+0:! inverts the status of implicit return
+
+ fn () {
+   false
+   ! return
+ }
+ fn
+1:! does not affect return status of explicit return