[Issue 12065] Some refused implicit string cast in pure methods

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Feb 3 04:07:22 PST 2014


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


yebblies <yebblies at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies at gmail.com
           Platform|x86                         |All
         OS/Version|Windows                     |All


--- Comment #1 from yebblies <yebblies at gmail.com> 2014-02-03 23:07:17 EST ---
It's a bug, the compiler thinks that `const(Bar[])` could potentially produce a
`char[]`.

string func1(in char[] x) pure
{
    char[] m = "".dup;
    return m; // works, can't get a char[] from const(char[]) without casting
}

enum Bar : char { A }

string func2(in Bar[] x) pure
{
    char[] m = "".dup;
    return m; // doesn't work, but should
}

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