www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3013] New: bizaar diagnose message

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3013

           Summary: bizaar diagnose message
           Product: D
           Version: 2.028
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: davidl 126.com


import std.string;

void main()
{
char[] s= string.format("abc","abc");
}

testd.d(5): Error: cannot implicitly convert expression (format((&
D20TypeInfo_B9AyaAyaAya6__initZ),(immutable(char)[]),
"abc","abc")) of type immutable(char)[] to char[]

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 20 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3013


ZHOU Zhenyu <rinick gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME
           Severity|normal                      |trivial




--- Comment #1 from ZHOU Zhenyu <rinick gmail.com>  2009-05-20 08:21:34 PDT ---
string.format("abc","abc");
 is same as
format(string, "abc", "abc");
 which means:
format(immutable(char)[], "abc", "abc");

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 20 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3013


david <davidl 126.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WORKSFORME                  |




--- Comment #2 from david <davidl 126.com>  2009-05-20 19:21:02 PDT ---
The point is the error message should not expose mangled name to users. The
original title is pretty clear.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 20 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3013


david <davidl 126.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
            Summary|bizaar diagnose message     |bizarre diagnostic message




--- Comment #3 from david <davidl 126.com>  2009-05-20 19:22:28 PDT ---
err , it was unclear.. there was a typo.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 20 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3013


Stewart Gordon <smjg iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com
            Summary|bizarre diagnostic message  |Weird message with cryptic
                   |                            |mangled name - implicit
                   |                            |conversion error




--- Comment #4 from Stewart Gordon <smjg iname.com>  2009-05-21 17:20:05 PDT ---
(In reply to comment #1)
 string.format("abc","abc");
  is same as
 format(string, "abc", "abc");
  which means:
 format(immutable(char)[], "abc", "abc");

I'm confused. Since when has it been legal to pass a type as a function argument? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 21 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3013


ZHOU Zhenyu <rinick gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rinick gmail.com




--- Comment #5 from ZHOU Zhenyu <rinick gmail.com>  2009-05-21 18:37:25 PDT ---
(In reply to comment #4)
 (In reply to comment #1)
 string.format("abc","abc");
  is same as
 format(string, "abc", "abc");
  which means:
 format(immutable(char)[], "abc", "abc");

I'm confused. Since when has it been legal to pass a type as a function argument?

It's not legal. I was just explaining the error message of this bug:
 import std.string;
 
 void main()
 {
 char[] s= string.format("abc","abc");
 }
 
 testd.d(5): Error: cannot implicitly convert expression (format((&
 D20TypeInfo_B9AyaAyaAya6__initZ),(immutable(char)[]),
 "abc","abc")) of type immutable(char)[] to char[]

-- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 21 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3013


Stewart Gordon <smjg 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 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: -------
May 22 2009