[Issue 12568] New: std.functional.memoize with constant array argument too
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Apr 12 15:13:07 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12568
Issue ID: 12568
Summary: std.functional.memoize with constant array argument
too
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P1
Component: Phobos
Assignee: nobody at puremagic.com
Reporter: bearophile_hugs at eml.cc
I'd like the len2 function to compile:
import std.functional: memoize;
uint len1(string s) { // OK
alias mLen1 = memoize!len1;
if (s.length == 0)
return 0;
else
return 1 + mLen1(s[1 .. $]);
}
uint len2(const string s) { // Error
alias mLen2 = memoize!len2;
if (s.length == 0)
return 0;
else
return 1 + mLen2(s[1 .. $]);
}
void main() {}
DMD 2.066alpha gives:
...\dmd2\src\phobos\std\functional.d(674,18): Error: cannot implicitly convert
expression (t) of type Tuple!string to Tuple!(const(immutable(char)[]))
...\dmd2\src\phobos\std\functional.d(682,14): Error: cannot implicitly convert
expression (t) of type Tuple!string to Tuple!(const(immutable(char)[]))
test.d(12,19): Error: template instance std.functional.memoize!(len2) error
instantiating
--
More information about the Digitalmars-d-bugs
mailing list