www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4745] New: Non-uniform handling of commas in static initialization of structs

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

           Summary: Non-uniform handling of commas in static
                    initialization of structs
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: stanislav.blinov gmail.com


--- Comment #0 from Stanislav Blinov <stanislav.blinov gmail.com> 2010-08-28
11:29:37 PDT ---
Compiler behaves differently for different cases when handling field
initializers for structs:

struct S1
{
    int a, b, c;

    static immutable S1 C1 = { 1 2 3 }; // no commas here, compiles
    static immutable S1 C2 = { 1, 2, 3 }; // compiles as well
}

int foo() { return 3; }

struct S2
{
    int a, b, c;

    static immutable S2 C1 = { foo() 2 3 }; // compiles (and works)
    static immutable S2 C2 = { foo() 2, 3 }; // compiles (and works)
    static immutable S2 C3 = { 2 foo() 3 }; // does not compile: comma expected
separating field initializers
}

Encountered this on 2.048 Windows (AMD64), 2.047 and 2.048 Linux (AMD64)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 28 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4745


Brad Roberts <braddr puremagic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Platform|x86_64                      |x86


--- Comment #1 from Brad Roberts <braddr puremagic.com> 2011-02-06 15:40:47 PST
---
Mass migration of bugs marked as x86-64 to just x86.  The platform run on isn't
what's relevant, it's if the app is a 32 or 64 bit app.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 06 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4745


kennytm gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid
                 CC|                            |kennytm gmail.com
           Platform|x86                         |All
         OS/Version|Linux                       |All


--- Comment #2 from kennytm gmail.com 2011-05-07 23:57:59 PDT ---
Whoa! How come the compile will accept the no-comma syntax at all?! It should
be rejected if
http://d-programming-language.org/declaration.html#StructMemberInitializers is
correct.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 08 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4745


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com


--- Comment #3 from Walter Bright <bugzilla digitalmars.com> 2011-06-11
16:38:18 PDT ---
https://github.com/D-Programming-Language/dmd/commit/b6b60755753bd237650dd2ae8e1190d103854475

https://github.com/D-Programming-Language/dmd/commit/b937e5729419f99ec1b0631c268fc9fbe6b42cc3

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 11 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4745


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 11 2011