<html><head><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; "><div><div>On Jun 19, 2013, at 10:59 AM, Larisse Voufo <<a href="mailto:lvoufo@google.com">lvoufo@google.com</a>> wrote:</div><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Jun 19, 2013 at 10:43 AM, John McCall <span dir="ltr"><<a href="mailto:rjmccall@apple.com" target="_blank">rjmccall@apple.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; "><div class="im">On Jun 19, 2013, at 9:15 AM, Larisse Voufo <<a href="mailto:lvoufo@google.com">lvoufo@google.com</a>> wrote:<br>


> Just out of curiosity, I have noticed that Clang currently allows the following program:<br>
><br>
> template<typename T> T f() { return 13; }<br>
> template int f() { return 1; }<br>
><br>
> It essentially parses the body of the explicit instantiation only to ignore it.<br>
> Was this a conscious decision?<br></div></blockquote><div><br></div><div>I just spoke to Richard Smith about this, and it appears that the current behavior is a bit different from the way I just described it above. </div>

<div>The declaration for the template instantiation is parsed, but the 'template' keyword is ignored, which leads to two different behaviors for the calls f() and f<int>().</div><div>While f() returns 1, f<int>() returns 13. f() picks up the declaration "<span style="color:rgb(80,0,80)">int f() { return 1; }" while f<int>() picks up the template declaration and implicitly instantiates it.</span></div>

<div> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; "><div class="im">
<br>
</div>No;  please file a bug.  You cannot define a function in an explicit instantiation.<br></blockquote><div><br></div><div style="">I can quickly fix this or submit a patch. Should I still file a bug? </div></div></div></div></blockquote><div><br></div>Fixing it is better. :)</div><div><br><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; "><div class="im">
> GCC 4.6.3 rejects the program with "expected ‘;’ before ‘{’ token".<br>
<br>
</div>Well, hopefully we can do better than that. <br></blockquote><div> </div><div style="">What do you have in mind? </div></div></div></div></blockquote><br></div><div>"error: cannot implement a function in an explicit instantiation"</div><div><br></div><div>or something along those lines.</div><div><br></div><div>John.</div><br></body></html>