[Issue 8892] New: Not precise error message with failed fixed size array assign

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 25 09:57:58 PDT 2012


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

           Summary: Not precise error message with failed fixed size array
                    assign
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2012-10-25 09:57:53 PDT ---
struct Foo {
    char[3] data;
}
int bar(Foo f) {
    return f.data[0];
}
void main() {
    auto f = Foo(['A', 'B']);
}


DMD 2.061alpha:

test.d(8): Error: cannot implicitly convert expression (['A','B']) of type
char[] to char


A better error message is:

test.d(8): Error: cannot implicitly convert expression (['A','B']) of type
char[] to char[4]

Or even something like:

test.d(8): Error: cannot implicitly convert expression (['A','B']) of type
char[] to char[4] ('Foo.data' field)

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