www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18565] New: std.regex Captures opAssign returns void since

https://issues.dlang.org/show_bug.cgi?id=18565

          Issue ID: 18565
           Summary: std.regex Captures opAssign returns void since
                    v2.079.0
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: d.bugs webfreak.org

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
---

--
Mar 06 2018