<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 22 January 2014 18:00, David Krauss <span dir="ltr">&lt;<a href="mailto:david_work@me.com" target="_blank">david_work@me.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div class="im"><br><div><div>On Jan 23, 2014, at 2:29 AM, Richard Smith &lt;<a href="mailto:richardsmith@google.com" target="_blank">richardsmith@google.com</a>&gt; wrote:</div><br><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;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<div class="gmail_extra"><div class="gmail_quote">Clang trunk also doesn&#39;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><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)">
<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">    std::cout &lt;&lt; &quot;hello\n&quot;;</div><div style="margin:0px;font-size:8px">    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></blockquote><div><br></div><div>Up until recently, Clang did not enforce this rule. In -pedantic-errors mode, Clang trunk rejects all of your above examples.</div></div></div></div>