consts cannot be used to initialize static declarations as per below code
snippet (thanks to Christophe Grenier).

int main()
{
   const unsigned int sizeof_buffer=512;
   static long long bmplcn = -sizeof_buffer - 1;
   printf("bmplcn=%lld\n", bmplcn);
   return 0;
} 

gcc -o /tmp/main /tmp/main.c
/tmp/main.c: In function 'main':
/tmp/main.c:5: error: initializer element is not constant

Confirmed with other gentoo devs that this fails in 4.2.2 as well.

gcc --version
gcc (GCC) 4.2.0 (Gentoo 4.2.0 p1.4)


-- 
           Summary: consts cannot be used to initialize static declarations
                    as per be below code snippet
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dragonheart at gentoo dot org
 GCC build triplet: x86_64-pc-linux-gnu
  GCC host triplet: x86_64-pc-linux-gnu
GCC target triplet: x86_64-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34586

Reply via email to