On Jan 11, 2008, at 1:00 PM, Eli Friedman wrote: > On Jan 11, 2008 12:34 PM, Steve Naroff <[EMAIL PROTECTED]> wrote: >> In any event, now I understand why EDG/NEILCC allow my original >> example (but not the revised example). > > I'm not sure I'm following... are EDG/NEILCC assuming that compound > literals in initializers for static local variables have static > storage duration? > It doesn't appear to be a legal extension per the > spec, because the spec explicitly states that because they are within > a function body, such compound literals have automatic storage > duration. clang could do the same thing as EDG/NEILCC's as an > extension, since it doesn't break any compliant C99 programs, but it > doesn't seem like an especially useful extension... >
Agreed. The spec is clear...the storage duration is determined by the location of the CompoundLiteral. If a compound literal within a function happens to be a constant expression, it still has automatic storage duration. snaroff > -Eli _______________________________________________ cfe-dev mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
