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

           Summary: CTFE:  wrong code for string[] ~= const(string)
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: clugd...@yahoo.com.au


--- Comment #0 from Don <clugd...@yahoo.com.au> 2011-04-18 03:15:36 PDT ---
int bug5852(const(string) s)
{
    string [] r;
    r ~= s;
    assert(r.length == 1);
    return r[0].length;
}

static assert(bug5852("abc")==3);

The (non-static) assert fails, and if it's commented out, you get:
test2.d(11): Error: integral constant must be scalar type, not string
test2.d(11): Error: cannot evaluate bug5852("abc") at compile time
test2.d(11): Error: static assert  (bug5852("abc") == 3) is not evaluatable at
c
ompile time

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

Reply via email to