struct Foo
{
int x, y, z;
}
void main()
{
Foo bar = Foo(1,);
}
This compiles without syntax errors, is this expected?
Thread overview | |||||
---|---|---|---|---|---|
|
April 25, 2021 Struct initialization extra comma - should it compile | ||||
---|---|---|---|---|
| ||||
This compiles without syntax errors, is this expected? |
April 25, 2021 Re: Struct initialization extra comma - should it compile | ||||
---|---|---|---|---|
| ||||
Posted in reply to JN | On Sunday, 25 April 2021 at 13:39:54 UTC, JN wrote: >
This compiles without syntax errors, is this expected? Yes, the specification is like this:
— Bastiaan. |
April 25, 2021 Re: Struct initialization extra comma - should it compile | ||||
---|---|---|---|---|
| ||||
Posted in reply to JN | On Sunday, 25 April 2021 at 13:39:54 UTC, JN wrote: >
This compiles without syntax errors, is this expected? Yes, D allows trailing commas in argument lists. |