Bug 6624 – Functions with Parameters Implicitly Convertible to Immutable Are Not Strongly Pure

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-09-08T07:00:00Z
Last change time
2013-06-15T13:43:49Z
Keywords
rejects-valid
Assigned to
nobody
Creator
dsimcha

Comments

Comment #0 by dsimcha — 2011-09-08T07:00:45Z
Using 2.055, where you're allowed to implicitly convert return values of strongly pure functions to immutable. char[] foo(string s) pure { return s.dup; } void main() { string dummy; string s = foo(dummy); } D:\home\dsimcha\bin\test.d(7): Error: cannot implicitly convert expression (foo(dummy)) of type char[] to string If I change the signature to: char[] foo(immutable string s) pure then it works.
Comment #1 by verylonglogin.reg — 2013-06-15T13:43:49Z
Works in HEAD.