www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20800] New: Error: cannot implicitly convert expression with

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

          Issue ID: 20800
           Summary: Error: cannot implicitly convert expression with bad
                    diagnostic.
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ibuclaw gdcproject.org

```
struct RegexMatch
{
    string index() { return null; }
    ~this() { }
}
static m() { return RegexMatch(); }

void initCommands()
{
    auto a = new int[](m.index);
}
```


Yields the error:

Error: cannot implicitly convert expression ((RegexMatch __tmpfordtor3 = m();)
, __tmpfordtor3).index() of type string to ulong


The exposed lowering of m.index should not be there in the message.

--
May 06