www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1356] New: Some parsing issues with struct initializers.

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1356

           Summary: Some parsing issues with struct initializers.
           Product: D
           Version: 1.017
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: aziz.kerim gmail.com


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 = {


-- 
Jul 20 2007
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1356


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug yahoo.com.au
         Resolution|                            |FIXED




 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. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 22 2011