mirror of
https://github.com/dlang/phobos.git
synced 2025-05-13 15:52:41 +03:00
Merge pull request #5657 from DmitryOlshansky/issue-17668
Fix issue 17668 - assert failure regex(q"<[^]>") merged-on-behalf-of: Dmitry Olshansky <DmitryOlshansky@users.noreply.github.com>
This commit is contained in:
commit
bcb17a6d88
2 changed files with 9 additions and 0 deletions
|
@ -1304,6 +1304,7 @@ if (isForwardRange!R && is(ElementType!R : dchar))
|
||||||
switch (op)
|
switch (op)
|
||||||
{
|
{
|
||||||
case Operator.Negate:
|
case Operator.Negate:
|
||||||
|
enforce(!stack.empty, "no operand for '^'");
|
||||||
stack.top = stack.top.inverted;
|
stack.top = stack.top.inverted;
|
||||||
break;
|
break;
|
||||||
case Operator.Union:
|
case Operator.Union:
|
||||||
|
|
|
@ -1098,3 +1098,11 @@ alias Sequence(int B, int E) = staticIota!(B, E);
|
||||||
willThrow([r"[a-\", r"123"], "invalid escape sequence");
|
willThrow([r"[a-\", r"123"], "invalid escape sequence");
|
||||||
willThrow([r"\", r"123"], "invalid escape sequence");
|
willThrow([r"\", r"123"], "invalid escape sequence");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// bugzilla 17668
|
||||||
|
@safe unittest
|
||||||
|
{
|
||||||
|
import std.algorithm.searching;
|
||||||
|
auto e = collectException!RegexException(regex(q"<[^]>"));
|
||||||
|
assert(e.msg.canFind("no operand for '^'"));
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue