This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/14805] New: file with structures and external decls at function scope is wrongly rejected


The following code is valid C and was accepted by 3.5:

int foo_A (void) {
  struct baz;
  struct bar {
    struct baz *x;
  };
  extern struct bar *foo;
  return foo->x == 0;
}

int foo_B (void) {
  struct baz {
     int y;
  };
  struct bar {
    struct baz *x;
  };
  extern struct bar *foo;
  return foo->x->y + 1 + foo_A();
}

but is rejected by current HEAD with the following:

/Network/Servers/cauchy/homes/thorin/gkeating/t.c: In function `foo_B':
/Network/Servers/cauchy/homes/thorin/gkeating/t.c:17: error: conflicting types for 'foo'
/Network/Servers/cauchy/homes/thorin/gkeating/t.c:6: error: previous declaration of 'foo' was here

-- 
           Summary: file with structures and external decls at function
                    scope is wrongly rejected
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: geoffk at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-apple-darwin7.2
  GCC host triplet: powerpc-apple-darwin7.2
GCC target triplet: powerpc-apple-darwin7.2


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]