<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 class="" style="white-space:pre">  </span>friend void DoA(Vec3& a) {</div>
<div><span class="" style="white-space:pre">            </span>a.m_int = 1;</div><div><span class="" style="white-space:pre">       </span>}</div><div>  </div><div><span class="" style="white-space:pre"> </span>template <const bool B></div>
<div><span class="" style="white-space:pre">    </span>friend void DoT(Vec3& a) {</div><div><span class="" style="white-space:pre">             </span>if (B)</div><div><span class="" style="white-space:pre">                     </span>a.m_int = 2;</div>
<div><span class="" style="white-space:pre">    </span>}</div><div>private:</div><div><span class="" style="white-space:pre">   </span>int m_int;</div><div>};</div><div><br></div><div>void test_friend_functions_inline() {</div>
<div><span class="" style="white-space:pre">    </span>Vec3 a;</div><div><span class="" style="white-space:pre">    </span>DoA(a);</div><div><span class="" style="white-space:pre">    </span>DoT<true>(a);  // error: use of undeclared identifier 'DoT'</div>
<div>}</div><div><br></div><div style>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">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 style><br></div><div style>Thanks!</div><div style>Will.</div>
</div></div>