1356 – Some parsing issues with struct initializers.

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 1356 - Some parsing issues with struct initializers.
Summary: Some parsing issues with struct initializers.
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Linux
: P2 normal
Assignee: No Owner
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
Reported: 2007年07月20日 15:39 UTC by Aziz Köksal
Modified: 2014年02月16日 15:21 UTC (History)
1 user (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Aziz Köksal 2007年07月20日 15:39:14 UTC
struct foo { int a = 4; }
static foo f = {a:void,}; // Void initializer allowed in struct initializer.
writefln(f.a); // prints 0
// Struct initializer can have any number of leading and trailing commas, whereas only a trailing one is allowed.
static foo f = {,,,,a:1,,,,};
// Compiler hangs if this is at the end of a file.
static foo f = {
Comment 1 Don 2011年12月22日 00:59:59 UTC
(In reply to comment #0)
> struct foo { int a = 4; }
> 
> static foo f = {a:void,}; // Void initializer allowed in struct initializer.
> writefln(f.a); // prints 0
This isn't a bug.
> 
> // Struct initializer can have any number of leading and trailing commas,
> whereas only a trailing one is allowed.
> static foo f = {,,,,a:1,,,,};
Fixed in 2.055 and 1.070.
> 
> // Compiler hangs if this is at the end of a file.
> static foo f = {
Fixed in 1.023.


AltStyle によって変換されたページ (->オリジナル) /