Bug 4353 – std.utf.stride doesn't work in ctfe

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Linux
Creation time
2010-06-20T13:45:00Z
Last change time
2011-06-17T01:19:16Z
Keywords
rejects-valid
Assigned to
nobody
Creator
ellery-newcomer

Comments

Comment #0 by ellery-newcomer — 2010-06-20T13:45:53Z
due to some petty stupid thing, unless you're willing to cast. This: import std.utf; void main(){ enum string s = "hi!"; enum int i = stride(s,0); } gives this: test.d(6): Error: function std.utf.stride called with argument types: ((string,int)) matches both: std.utf.stride(in const(char[]) s, uint i) and: std.utf.stride(in const(dchar[]) s, uint i) comment out the enums and it does no such thing. Actually, pretending a char[] is a dchar[] might not be petty..
Comment #1 by clugdbug — 2010-12-08T05:09:58Z
Actually this isn't a CTFE bug. The issue is implicit conversion of string literals. ------- void stride(const(char[]) s) {} void stride(const(dchar[]) s) {} void main(){ string w = "hi"; stride(w); // ok stride("hi"[]); // ok stride("hi"); // fails } ------
Comment #2 by clugdbug — 2011-06-17T01:19:16Z
*** This issue has been marked as a duplicate of issue 2367 ***