tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] struct initializer bug


From: Dave Dodge
Subject: [Tinycc-devel] struct initializer bug
Date: Fri, 23 Feb 2007 08:12:35 -0500
User-agent: Mutt/1.5.12-2006-07-14

I have some recent code that uses a lot of elaborate initializers, and
more than one file triggered this error.  It says "field expected" for
the line containing the .v initializer in the second structure,
perhaps as if it doesn't think that the .p initializer is finished.  I
only briefly glanced at the compiler and it looks like it's got to be
in decl_designator() since that's the only function that produces this
error message.  Minor changes, such as removing the "y" field from
struct point, or removing the ".v" initializer, make the error go
away.

                                                  -Dave Dodge




struct point{
        int x,y;
};

struct obj{
        struct point p;
        int v;
};

void foo(void)
{
        /* this works */
        struct obj zz1 = {
                .p = (struct point){ .x = 0 },
                .v = 0
        };

        /* this does not */
        struct point p = { .x = 0 };
        struct obj zz2 = {
                .p = p,
                .v = 0
        }
}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]