www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4353] New: std.utf.stride doesn't work in ctfe

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4353

           Summary: std.utf.stride doesn't work in ctfe
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: ellery-newcomer utulsa.edu



13:45:53 PDT ---
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..

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 20 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4353


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
                 CC|                            |clugdbug yahoo.com.au



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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 08 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4353


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE



*** This issue has been marked as a duplicate of issue 2367 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 17 2011