[Issue 13490] New: Can't append to array of structs with alias this as lvalue ternary opoerator result

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Sep 18 01:43:35 PDT 2014


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 at puremagic.com
          Reporter: verylonglogin.reg at 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[]*
---

--


More information about the Digitalmars-d-bugs mailing list