diff --git a/src/QRegex/P6Regex/Actions.nqp b/src/QRegex/P6Regex/Actions.nqp index b5f3d3d0f4..cee2db9f1f 100644 --- a/src/QRegex/P6Regex/Actions.nqp +++ b/src/QRegex/P6Regex/Actions.nqp @@ -772,6 +772,13 @@ class QRegex::P6Regex::Actions is HLL::Actions { QAST::Regex.new( :rxtype, :name<.> ) ) !! QAST::Regex.new( :rxtype, |@alts ); } + + if $qast.rxtype ne 'cclass' && +@($qast) == 0 { + $/.panic('Cannot have an empty character class. If you intended to include ' + ~ 'whitespace within this character class, escape it with \\' + ); + } + make $qast; }