[Issue 19237] New: string mixin struct initializer doesn't compile

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Sep 10 10:09:52 UTC 2018


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

          Issue ID: 19237
           Summary: string mixin struct initializer doesn't compile
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: radu.racariu at gmail.com

The following, will not compile
```
struct S
{
    int i;
}

void main()
{
    S s = mixin(`{1}`);
}
```

Error:
found } when expecting ; following statement
app.d-mixin-8(8): Error: found End of File when expecting } following compound
statement

But this will compile:
```
struct S
{
    int i;
}

void main()
{
    S s = mixin(`S(1)`);
}
```

I think the initializer should compile, as array initializers are allowed in
the mixin, for example this works:

```
struct S
{
    int i;
}

void main()
{
    S[] s = mixin(`[S(1), S(2)]`);
}
```

--


More information about the Digitalmars-d-bugs mailing list