[Bug c/53196] New: unknown struct name in C99 compound initializer doesn't generate error

lzie59p1 at frolickingcow dot net gcc-bugzilla@gcc.gnu.org
Wed May 2 17:55:00 GMT 2012


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

             Bug #: 53196
           Summary: unknown struct name in C99 compound initializer
                    doesn't generate error
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: lzie59p1@frolickingcow.net


I think this code shouldn't compile (see foo_typo). It compiles on 4.5.3 and
4.7.0.

#include <stdio.h>

struct foo {
    int i;
};

int
main(void)
{
    struct foo f = (struct foo_typo) { };
    printf("%d\n", f.i);
    return 0;
}



More information about the Gcc-bugs mailing list