[Issue 3013] Weird implicit conversion error with cryptic mangled name - assigning to invalid arraytype.function call

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 22 02:53:49 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3013


Stewart Gordon <smjg at iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|2.028                       |1.043
            Summary|Weird message with cryptic  |Weird implicit conversion
                   |mangled name - implicit     |error with cryptic mangled
                   |conversion error            |name - assigning to invalid
                   |                            |arraytype.function call




--- Comment #6 from Stewart Gordon <smjg at iname.com>  2009-05-22 02:53:48 PDT ---
So the bug is that it tries to make out the type of the expression and gets
somewhere (and hence delivers an error) before realising that string.format is
itself invalid.

The bug also occurs in DMD 1.043, as this shows:
----------
import std.string;

void main() {
    int s = string.format("abc", "def");
}
----------
array_static_method.d(4): Error: cannot implicitly convert expression
(format((&
 D17TypeInfo_B6AaAaAa6__initZ),(char[]),"abc","def")) of type char[] to int
----------

Strangely, given (int[]) instead of string, 2.030 gives an almost identical
cryptic message, but 1.043 emits the more sensible
----------
array_static_method.d(4): Error: no property 'format' for type 'int[]'
array_static_method.d(4): Error: function expected before (), not 1 of type int
----------
(OK, so the second message is bogus, but that's just a case of a long-known
issue.)

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


More information about the Digitalmars-d-bugs mailing list