[cfe-dev] Visibility of inline defined friend template function
Will Wilson
will at indefiant.com
Tue Jul 9 08:38:52 PDT 2013
Hi All,
A quick question regarding correct behaviour:
class Vec3 {
public:
friend void DoA(Vec3& a) {
a.m_int = 1;
}
template <const bool B>
friend void DoT(Vec3& a) {
if (B)
a.m_int = 2;
}
private:
int m_int;
};
void test_friend_functions_inline() {
Vec3 a;
DoA(a);
DoT<true>(a); // error: use of undeclared identifier 'DoT'
}
This compiles in MSVC but not clang. Any idea what's doing the right thing?
I'm running into it with squish-ccr:
https://github.com/Ethatron/squish-ccr/blob/master/simd_sse.h which makes
extensive use of the inline-friend-template-function pattern.
Thanks!
Will.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130709/73a6a516/attachment.html>
More information about the cfe-dev
mailing list