[Issue 4302] New: compiler errors using startsWith in CTFE

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jun 13 01:17:37 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4302

           Summary: compiler errors using startsWith in CTFE
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: r.sagitario at gmx.de


--- Comment #0 from Rainer Schuetze <r.sagitario at gmx.de> 2010-06-13 01:17:32 PDT ---
the following code fails with dmd 2.047:

import std.algorithm;

const bool var = startsWith("ab", "a");

dmd output:

c:\l\dmd2\windows\bin\..\..\src\phobos\std\functional.d(176): Error: static
assert  "Bad binary function q{a == b}. You need to use a valid D expression
using symbols a of type dchar and b of type string."
c:\l\dmd2\windows\bin\..\..\src\phobos\std\functional.d(179):       
instantiated from here: Body!(dchar,string)
c:\l\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(1983):       
instantiated from here: result!(dchar,string)

the error disappears if you remove the "const".

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


More information about the Digitalmars-d-bugs mailing list