#2124 error during function array initializing

closed-fixed
Ben Shi
Front-end
5
2015-02-08
2013-01-05
mz-fuzzy
No

This (in my opinion valid) code returns error:
---------------------------------------------
typedef int (*DT)(void);

int f1(void);
int f2(void);

DT arr[] = {
(DT)f1,
(DT)f2
};
-------------------------------------
command line: sdcc -c -mz80 <filename.c>
Returns:
sdccerr.c:7: error 2: Initializer element is not constant
sdccerr.c:9: error 2: Initializer element is not constant
sdccerr.c:7: error 2: Initializer element is not constant
sdccerr.c:9: error 2: Initializer element is not constant

SDCC : mcs51/gbz80/z80/z180/r2k/r3ka/ds390/pic16/pic14/TININative/ds400/hc08/s08 3.2.1 #8331 (Jan 4 2013) (Linux)

Discussion

    • Category: --> Front-end
     
  • Maarten Brock
    Maarten Brock
    2013-12-25

    Funny enough all ports but the mcs51 show this problem.

     
  • Ben Shi
    Ben Shi
    2015-02-08

    • status: open --> closed-fixed
    • assigned_to: Ben Shi
     
  • Ben Shi
    Ben Shi
    2015-02-08

    Fixed in reversion #9178.