Bug 7662 – int[1u] not implicitly convertible to immutable

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2012-03-07T10:55:00Z
Last change time
2013-01-10T15:03:08Z
Keywords
rejects-valid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2012-03-07T10:55:47Z
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
Comment #1 by andrej.mitrovich — 2013-01-10T15:03:08Z
Works in 2.061+