Bug 18565 – std.regex Captures opAssign returns void since v2.079.0
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-03-06T21:27:22Z
Last change time
2018-03-13T02:31:12Z
Assigned to
No Owner
Creator
Jan Jurzitza
Comments
Comment #0 by d.bugs — 2018-03-06T21:27:22Z
Before commit 59520969ef73eaf0691972ee00b389e5bbc4c8fb this code used to work:
---
import std.regex;
void main()
{
string str;
Captures!string match;
if (cast(bool)(match = str.matchFirst("a"))
|| cast(bool)(match = str.matchFirst("b"))) {}
}
---
and it performed the expected operations. However now the compilation fails with:
---
a.d(7): Error: cannot cast expression match.opAssign(matchFirst(str, "a")) of type void to bool
a.d(8): Error: cannot cast expression match.opAssign(matchFirst(str, "b")) of type void to bool
---
Comment #1 by github-bugzilla — 2018-03-13T02:31:08Z