[Issue 8818] New: CTFE fails to compare strings correctly

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Oct 14 06:16:30 PDT 2012


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

           Summary: CTFE fails to compare strings correctly
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: CTFE
          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> 2012-10-14 06:16:27 PDT ---
Compiling with current version from github:

bool test()
{
    string op1 = "aa";
    string op2 = "b";
    assert("b" >= "aa");
    assert(op2 >= op1);
    return true;
}

pragma(msg,test());

void main()
{
}

produces:

test.d(7): Error: assert(op2 >= op1) failed
test.d(11):        called from here: test()
test()

This does not happen with dmd 2.060. The regression was probably introduced
with this commit:

SHA-1: f3ee71f1f422fd0ee8863109469f4065a8305b5f

* Merge pull request #1114 from donc/ctfe8644_arrayliteralcmp

Fix bug 8644 - CTFE doesn't support string <,> on array literals

and is caused by ctfeRawCmp in interpret.c changing the semantics of the
comparison, because it compares the length of arrays before looking at the
contents.

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