<div dir="ltr">FYI: GCC also seems to accept the code.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On 9 July 2013 17:38, Will Wilson <span dir="ltr"><<a href="mailto:will@indefiant.com" target="_blank">will@indefiant.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi All,<div><br></div><div>A quick question regarding correct behaviour: <br clear="all"><div><br></div>
<div>class Vec3 {</div><div>public:</div><div><span style="white-space:pre-wrap"> </span>friend void DoA(Vec3& a) {</div>
<div><span style="white-space:pre-wrap"> </span>a.m_int = 1;</div><div><span style="white-space:pre-wrap"> </span>}</div><div> </div><div><span style="white-space:pre-wrap"> </span>template <const bool B></div>
<div><span style="white-space:pre-wrap"> </span>friend void DoT(Vec3& a) {</div><div><span style="white-space:pre-wrap"> </span>if (B)</div><div><span style="white-space:pre-wrap"> </span>a.m_int = 2;</div>
<div><span style="white-space:pre-wrap"> </span>}</div><div>private:</div><div><span style="white-space:pre-wrap"> </span>int m_int;</div><div>};</div><div><br></div><div>void test_friend_functions_inline() {</div>
<div><span style="white-space:pre-wrap"> </span>Vec3 a;</div><div><span style="white-space:pre-wrap"> </span>DoA(a);</div><div><span style="white-space:pre-wrap"> </span>DoT<true>(a); // error: use of undeclared identifier 'DoT'</div>
<div>}</div><div><br></div><div>This compiles in MSVC but not clang. Any idea what's doing the right thing? I'm running into it with squish-ccr: <a href="https://github.com/Ethatron/squish-ccr/blob/master/simd_sse.h" target="_blank">https://github.com/Ethatron/squish-ccr/blob/master/simd_sse.h</a> which makes extensive use of the inline-friend-template-function pattern.</div>
<div><br></div><div>Thanks!</div><span class="HOEnZb"><font color="#888888"><div>Will.</div>
</font></span></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div><span style="background-color:rgb(255,255,255);color:rgb(68,68,68);font-family:Arial,Helvetica,sans-serif"><b>Indefiant Ltd.</b></span></div><div><font color="#444444" face="Arial, Helvetica, sans-serif"><span style="font-size:12px"><b><br>
</b></span></font></div><font color="#444444" face="Arial, Helvetica, sans-serif"><span style="font-size:12px">Firsby Lodge, New Main Road, Scamblesby, Louth, Lincs LN11 9XH UK<br></span></font><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;background-color:rgb(255,255,255)">
<span style="color:rgb(68,68,68);font-family:Arial,Helvetica,sans-serif;font-size:x-small"><i>Tel: +44 20 8123 7663 England Registered No. 07936820 VAT No. </i></span><span style="background-color:transparent"><font color="#444444" face="Arial, Helvetica, sans-serif" size="1"><i>128556202</i></font></span></div>
</div>