fixed bug #453370
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 21 Aug 2001 10:30:42 +0000 (10:30 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 21 Aug 2001 10:30:42 +0000 (10:30 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1158 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCval.c

index 2f5b9710076e6d14edd5cd26af3363233eb4c067..357b503e07a6aa6858f4e15a30f60b3d5ecfe3bf 100644 (file)
@@ -1311,7 +1311,7 @@ getNelements (sym_link * type, initList * ilist)
     ilist = ilist->init.deep;
 
   /* if type is a character array and there is only one
-     initialiser then get the length of the string */
+     (string) initialiser then get the length of the string */
   if (IS_ARRAY (type) && IS_CHAR (etype) && !ilist->next)
     {
       ast *iast = ilist->init.node;
@@ -1321,12 +1321,12 @@ getNelements (sym_link * type, initList * ilist)
          werror (E_INIT_WRONG);
          return 0;
        }
-      if (!IS_ARRAY (v->type) || !IS_CHAR (v->etype))
+
+      if (IS_ARRAY (v->type) && IS_CHAR (v->etype))
+       // yep, it's a string
        {
-         werror (E_INIT_WRONG);
-         return 0;
+         return DCL_ELEM (v->type);
        }
-      return DCL_ELEM (v->type);
     }
 
   i = 0;