diff options
-rw-r--r-- | libbuild2/parser.cxx | 3 | ||||
-rw-r--r-- | tests/switch/testscript | 8 |
2 files changed, 10 insertions, 1 deletions
diff --git a/libbuild2/parser.cxx b/libbuild2/parser.cxx index a8abbfb..a6a5a83 100644 --- a/libbuild2/parser.cxx +++ b/libbuild2/parser.cxx @@ -392,7 +392,8 @@ namespace build2 { f = &parser::parse_switch; } - else if (n == "case") + else if (n == "case" || + n == "default") { // Valid ones are handled in parse_switch(). // diff --git a/tests/switch/testscript b/tests/switch/testscript index f6c3753..e0ffe8e 100644 --- a/tests/switch/testscript +++ b/tests/switch/testscript @@ -204,6 +204,14 @@ EOI 1,d EOO +: case-outside +: +$* <<EOI 2>>EOE != 0 +case 1 +EOI +<stdin>:1:1: error: case outside switch +EOE + : default-before-case : $* <<EOI 2>>EOE != 0 |