[Issue 7662] New: int[1u] not implicitly convertible to immutable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 7 10:55:44 PST 2012


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

           Summary: int[1u] not implicitly convertible to immutable
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2012-03-07 10:55:47 PST ---
Maybe related to issue 7661

I think the assignment at line 5 has to be valid, because int[1] is a value
that gets copied to another immutable value:


int[1] foo() {
    return [1];
}
void bar(F)(F fun) {
    immutable x = fun(); // line 5
}
void main() {
    bar(&foo); // line 8
}


test.d(5): Error: cannot implicitly convert expression ((*fun)()) of type
int[1u] to immutable(int)[]
test.d(8): Error: template instance test.bar!(int[1u] function()) error
instantiating

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