[Issue 11941] New: Errors when appending to aggregate member array in CTFE

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jan 17 14:39:44 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=11941

           Summary: Errors when appending to aggregate member array in
                    CTFE
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: CTFE, rejects-valid
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: nilsbossung at googlemail.com


--- Comment #0 from Nils <nilsbossung at googlemail.com> 2014-01-17 14:39:42 PST ---
Works with 2.064.2.
Fails with v2.065-devel-2b521dd.

---
cat > test.d << code
alias E = string;
void takeConst(const E[]) {}
E[] identity(E[] x) {return x;}
static assert({
    struct S
    {
        E[] a;
    }
    S s;

    takeConst(identity(s.a));
    version(A) s.a ~= [];
    else version(B)
    {
        s.a ~= "foo"; /* Error refers to this line (15), */
        E[] b = s.a[]; /* but only when this is here. */
    }

    return true;
}());
code
echo A; dmd -c -version=A test.d
echo B; dmd -c -version=B test.d
---
A
test.d(12): Error: Cannot interpret s.a ~= [] at compile time
test.d(20):        called from here: (*() => true)()
test.d(4):        while evaluating: static assert((*() => true)())
B
test.d(15): Error: array cast from string to string[] is not supported at
compile time
test.d(20):        called from here: (*() => true)()
test.d(4):        while evaluating: static assert((*() => true)())
---

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


More information about the Digitalmars-d-bugs mailing list