[Bug c/40656] New: Can't initial the fields of unamed struct/union.

View: New views
4 Messages — Rating Filter:   Alert me  

[Bug c/40656] New: Can't initial the fields of unamed struct/union.

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

xiaosuo@gentux test $ cat unamed.c
struct test {
        struct {
                int a;
        };
};

int main()
{
        struct test t1;
        t1.a = 0; /* it is OK */

        struct test t2 = {.a = 0}; /* error */

        return 0;
}
xiaosuo@gentux test $ gcc unamed.c
unamed.c: In function 'main':
unamed.c:12: error: unknown field 'a' specified in initializer


--
           Summary: Can't initial the fields of unamed struct/union.
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: xiaosuo at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40656


[Bug c/40656] Can't initial the fields of unamed struct/union.

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #1 from rguenth at gcc dot gnu dot org  2009-07-06 10:15 -------
Use

  struct test t2 = { { .a = 0 } };


--

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40656


[Bug c/40656] Can't initial the fields of unamed struct/union.

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #2 from pinskia at gcc dot gnu dot org  2009-07-06 19:30 -------
Reopening to ...


--

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40656


[Bug c/40656] Can't initial the fields of unamed struct/union.

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #3 from pinskia at gcc dot gnu dot org  2009-07-06 19:30 -------
Mark as a duplicate of bug 10676 which is still open by the way.

*** This bug has been marked as a duplicate of 10676 ***


--

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40656