This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c/7958: gnu99 doesn't allow compound literals for static initializers


>Number:         7958
>Category:       c
>Synopsis:       gnu99 doesn't allow compound literals for static initializers
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 17 18:46:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     mrs@apple.com
>Release:        gcc version 3.1 20020420
>Organization:
>Environment:

>Description:
GNU gnu99 is missing a feature, compound literals for static initializers should be accepted in gnu99 mode, as they are in gnu89 mode.

http://gcc.gnu.org/onlinedocs/gcc/Compound-Literals.html#Compound%20Literals
typedef struct A { int i; } At;

void foo() {
  static At a = (At){0};
  static int y[] = (int []) {1, 2, 3};
}

bash-2.05a$ gcc -c -xc t3.m -std=gnu99
t3.m: In function `foo':
t3.m:4: initializer element is not constant
t3.m:5: array initialized from non-constant array expression

See also Radar 3033979.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]