Menu

#2364 Initialization of a constant variable

closed-fixed
Ben Shi
None
Front-end
5
2015-03-20
2015-03-16
No

const char TWO=2;
const char THREE=TWO+1;

S.c:2: error 129: pointer types incompatible
S.c:2: error 2: Initializer element is not constant

SDCC : 3.4.3 #9194 (Mar 16 2015) (MINGW64)


Arnost Vecerka

Discussion

  • Philipp Klaus Krause

    What's the bug here? Should the error mesage be clearer, maybe somthing like "Initializer element is not a constant expression"?

    Philipp

     

    Last edit: Philipp Klaus Krause 2015-03-16
  • Ben Shi

    Ben Shi - 2015-03-17

    Even gcc 4.x gives the simliar error:

    S.c:2: error: initializer element is not constant

     
  • Ben Shi

    Ben Shi - 2015-03-20

    In reversion #9197, error 129 is eliminated and only error 2 rises.

    sdcc S.c -c
    S.c:2: error 2: Initializer element is not constant

    sdcc -v
    SDCC : mcs51/z80/z180/r2k/r3ka/gbz80/ds390/TININative/ds400/hc08/s08/stm8 3.4.3 #9197 (Mar 20 2015) (Linux)
    published under GNU General Public License (GPL)

     
  • Ben Shi

    Ben Shi - 2015-03-20
    • status: open --> closed-fixed
    • assigned_to: Ben Shi
     

Log in to post a comment.