www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11941] New: Errors when appending to aggregate member array in CTFE

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: nilsbossung googlemail.com



---
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: -------
Jan 17 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11941


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
            Version|unspecified                 |D2



It's a regression caused by fixing bug 11534.

https://github.com/D-Programming-Language/dmd/pull/3112


Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/a8daf6bb9aac4195640bee70ccb071244c0a9473
fix Issue 11941 - Errors when appending to aggregate member array in CTFE

https://github.com/D-Programming-Language/dmd/commit/2b7391235d23aee81d049bafd1fe4aa3b1958623


[REG2.065a] Issue 11941 - Errors when appending to aggregate member array in
CTFE

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 18 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11941


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 18 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11941




Commit pushed to release at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/ee4af52177e64945c107e17ae647ac22f78fd213


[REG2.065a] Issue 11941 - Errors when appending to aggregate member array in
CTFE

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