]> git.gag.com Git - fw/sdcc/commitdiff
throw an error for non-constant auto initializers
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 6 Apr 2001 12:33:57 +0000 (12:33 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 6 Apr 2001 12:33:57 +0000 (12:33 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@728 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCast.c

index e5b321cad83b0c5533cdb6fe35939a4a653b4fec..2824561ad249cf27cd3c2879c28cb94850e3b856 100644 (file)
@@ -1002,6 +1002,11 @@ gatherAutoInit (symbol * autoChain)
          SPEC_SCLS (sym->etype) != S_CODE)
        {
          symbol *newSym;
+         
+         // this can only be a constant
+         if (!IS_LITERAL(sym->ival->init.node->etype)) {
+           werror (E_CONST_EXPECTED);
+         }
 
          /* insert the symbol into the symbol table */
          /* with level = 0 & name = rname       */