[Issue 12150] Regression (2.063): char[] implicitly converts to string in .dup expression

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 13 07:42:52 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12150


Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


--- Comment #7 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2014-02-13 07:42:50 PST ---
(In reply to comment #5)
> I might be missing something, but where is the regression? The example you
> posted doesn't seem to be a regression because char[] isn't implicitly
> convertible to either `string` or `ubyte[]`, so surely the code would simply
> not compile.

Ah I thought it would compile, after I added an explicit cast to avoid the
recursive call it ended up compiling, but it wouldn't otherwise even though I
thought it would. So you're right.

There's no regression here. The below test-case works properly:

-----
int foo(string arg)
{
    return foo(arg.dup);  // calls second overload
}

int foo(char[] b)
{
    assert(0);
}

void main()
{
    auto x = foo("");
}
-----

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list