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

--- Comment #0 from Don <> 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
ompile time

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to