<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Jan 23, 2014, at 2:29 AM, Richard Smith &lt;<a href="mailto:richardsmith@google.com">richardsmith@google.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="gmail_extra"><div class="gmail_quote">Clang trunk also doesn't allow it with -pedantic-errors. Both GCC and Clang reject decltype(main()) too, in strictly-conforming mode. EDG rejects odr-uses of main but accepts uses that are not odr-uses.</div></div></div></blockquote></div><div><br></div><div>It looks like Clang and GCC reject unevaluated call expressions and unary &amp; expressions, but other non-ODR uses go undetected.</div><div><br></div><div>(void) main; // no diagnosis</div><div>(void) &amp; main; // diagnosis</div><div><br></div><div>Also, this ODR use which avoids function pointer conversion gets no diagnosis from either.</div><div><br></div><div><div style="margin: 0px; font-size: 8px; font-family: Monaco; color: rgb(245, 245, 245); background-color: rgb(0, 0, 0);">template&lt; int (&amp;)() &gt;</div><div style="margin: 0px; font-size: 8px; font-family: Monaco; color: rgb(245, 245, 245); background-color: rgb(0, 0, 0);">struct s {};</div></div><div><div style="margin: 0px; font-size: 8px; font-family: Monaco; color: rgb(245, 245, 245); background-color: rgb(0, 0, 0);">s&lt; main &gt; q; // no diagnosis</div></div><div><br></div><div>GCC diagnoses this analogous case, but Clang does not; it happily generates the recursive program.</div><div><br></div><div><div style="margin: 0px; font-size: 8px; font-family: Monaco; color: rgb(245, 245, 245); background-color: rgb(0, 0, 0); position: static; z-index: auto;"><div style="margin: 0px; font-size: 8px;">#include &lt;iostream&gt;</div><div style="margin: 0px; font-size: 8px; min-height: 11px;"><br></div><div style="margin: 0px; font-size: 8px;">void f( int (&amp;p)() ) { p(); }</div><div style="margin: 0px; font-size: 8px; min-height: 11px;"><br></div><div style="margin: 0px; font-size: 8px;">int main() {</div><div style="margin: 0px; font-size: 8px;">&nbsp; &nbsp; std::cout &lt;&lt; "hello\n";</div><div style="margin: 0px; font-size: 8px;">&nbsp; &nbsp; f( main ); // GCC diagnosis, not Clang.</div><div style="margin: 0px; font-size: 8px;">}</div><div><br></div></div></div><div><br></div><div>For the record, the GCC manual says that -pedantic and -pedantic-errors are required to get ISO-required diagnoses that aren’t “gratuitous.” So it seems there’s no sense worrying what they allow in non-pedantic mode.</div><div><br></div></body></html>