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

             Bug #: 53530
           Summary: const variables not constant enough to be used as
                    initializers
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: cpy.prefers....@gmail.com


Initializations using constant variables generates an error.
When compiling the following source code, GCC gives `error: initializer element
is not constant`, while Clang made it successfully.

/* this is test.c */
/* compile me using `gcc test.c -c` or `clang test.c -c` */
static const int a = 0;   /* in GCC I have to initialize it explicitly, to */
                        /* ensure that it would to be placed into */
                        /* .rodata section (or maybe .text) */
static int b[] = { [0] = a, };
/* end of test.c */

I'm currently using `gcc (GCC) 4.7.0 20120505 (prerelease)` on a laptop with
GNU/Linux.

Reply via email to