www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13490] New: Can't append to array of structs with alias this

https://issues.dlang.org/show_bug.cgi?id=13490

          Issue ID: 13490
           Summary: Can't append to array of structs with alias this as
                    lvalue ternary opoerator result
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: verylonglogin.reg gmail.com

This code should compile:
---
struct S
{
    int i;
    alias i this;
}

struct T
{
    S[] a1, a2;
}


void main()
{
    T t;
    (1 ? t.a1 : t.a2) ~= S.init;
}
---
main.d(16): Error: &t.a1 is not an lvalue
main.d(16): Error: &t.a2 is not an lvalue
main.d(16): Error: cannot append type S to type S[]*
---

--
Sep 18 2014