www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19971] New: wrong string literals in "cannot pass argument"

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

          Issue ID: 19971
           Summary: wrong string literals in "cannot pass argument" errors
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: diagnostic, ice
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ag0aep6g gmail.com

I've noticed this bug when reading this forum post:
https://forum.dlang.org/post/rjdgoaoowxgvekraktwx forum.dlang.org

Code:
----
void f(int x) {}
void main()
{
    f("%i");
}
----

The error message says (DMD 2.086.0):
----
test.d(4):        cannot pass argument "1" of type string to parameter int x
----

Instead it should say:
----
test.d(4):        cannot pass argument "%i" of type string to parameter int x
----

With `f("%s");` DMD even segfaults.

Fix incoming.

--
Jun 15 2019