Folks,
Eli and I have been on improving clang's support for Compound Literals.
GCC and EDG produce different diagnostics for the following program.
void a(void) {
int tmp;
static int *t = &tmp; // Both GCC and EDG issue an error
diagnostic ("initializer element is not constant").
static int *a = (int[]){1}; // GCC issues an error diagnostic for this
as well (but EDG allows it).
}
C99 6.5.2.5p6 says the following:
The value of the compound literal is that of an unnamed object
initialized by the
initializer list. If the compound literal occurs outside the body of a
function, the object
has static storage duration; otherwise, it has automatic storage
duration associated with
the enclosing block.
This seems pretty clear to me...GCC is right and EDG is wrong.
Anyone disagree?
snaroff
_______________________________________________
cfe-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev