<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Folks,<div><br class="webkit-block-placeholder"></div><div>Eli and I have been on improving clang's support for Compound Literals.</div><div><br class="webkit-block-placeholder"></div><div>GCC and EDG produce different diagnostics for the following program.</div><div><br class="webkit-block-placeholder"></div><div><div>void a(void) {</div><div>int tmp;</div><div>static int *t = &tmp;        // Both GCC and EDG issue an error diagnostic ("initializer element is not constant").</div><div>static int *a = (int[]){1}; // GCC issues an error diagnostic for this as well (but EDG allows it).</div><div>}</div><div><br class="webkit-block-placeholder"></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Times; font-size: 14px; ">C99 6.5.2.5p6 says the following:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Times; font-size: 14px; "><br class="webkit-block-placeholder"></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Times; font-size: 14px; ">The value of the compound literal is that of an unnamed object initialized by the<span style="font: normal normal normal 12px/normal Helvetica; font-size: 14px; "> </span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Times; font-size: 14px; ">initializer list. If the compound literal occurs outside the body of a function, the object<span style="font: normal normal normal 12px/normal Helvetica; font-size: 14px; "> </span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Times; font-size: 14px; ">has static storage duration; otherwise, it has automatic storage duration associated with<span style="font: normal normal normal 12px/normal Helvetica; font-size: 14px; "> </span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Times; font-size: 14px; ">the enclosing block.<span style="font: normal normal normal 12px/normal Helvetica; font-size: 14px; "> </span></div><div><br class="webkit-block-placeholder"></div>
</div><div><div>This seems pretty clear to me...GCC is right and EDG is wrong.</div><div><br class="webkit-block-placeholder"></div><div>Anyone disagree?</div><div><br class="webkit-block-placeholder"></div><div>snaroff</div></div></div></body></html>