#1217 typedef struct foo foo;

closed-fixed
5
2013-05-25
2006-10-18
No

The following code is legal ANSI C, but SDCC fails to
compile it:

typedef struct foo foo;
struct foo
{
int bar;
};

The error returned is

syntax error: token -> 'foo' ; column 10

Expected behaviour: compile with no error.

(The struct tag name space and the general symbol name
space, where the typedef goes, are separate. Typedefs
like this keep the two name spaces in synch. The
forward declaration of the struct means that you can
use the typedef inside the struct itself, eg for
pointer to self in linked lists, whithout the struct
keyword.)

My version of SDCC is

SDCC :
mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08
2.5.0 #1020 (Oct 18 2006) (UNIX)

Discussion

  • Maarten Brock

    Maarten Brock - 2010-07-30
    • labels: --> C-Front End
    • milestone: --> fixed
    • assigned_to: nobody --> maartenbrock
    • status: open --> closed-fixed
     
  • Maarten Brock

    Maarten Brock - 2010-07-30

    Fixed in SDCC 2.9.7 #5897.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks