<p dir="ltr">Your code example has several other errors in it, can you provide us with the actual code that produced the reported error?</p>
<div class="gmail_quote">On Dec 13, 2015 10:52 AM, "Uri Mann via cfe-dev" <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I have the following code:<br>
// header1.h<br>
class Infc;<br>
template<typename Type><br>
struct Struct {<br>
        Infc* _infc;<br>
        Struct(Infc* infc) : _infc(infc) {}<br>
        ~ Struct() { _infc->destroy(this); }<br>
};<br>
<br>
// header2.h<br>
template<typename> friend struct Struct;<br>
class Infc {<br>
public:<br>
        virtual void create() = 0;      // For everyone<br>
private:<br>
        template<typename> friend struct Struct;<br>
        virtual void destroy(void* _this) = 0;  // Only for friends<br>
};<br>
<br>
// source.cpp<br>
#include "header1.h"<br>
#include "header2.h"<br>
Infc* g_infc;<br>
void f() {<br>
        Struct s(g_infc);<br>
}<br>
<br>
CLANG issue the following error:<br>
1>  In file included from source.cpp:<br>
1>header1.h: error : 'destroy' is a private member of 'Infc'<br>
1>      ~ Struct() { _infc->destroy(this); }<br>
1>                      ^<br>
1>  header2.h :  note: declared private here<br>
1>      virtual void destroy(void* _this) = 0;<br>
1>                   ^<br>
<br>
What am I doing wrong? Why is the friendship not recognized?<br>
<br>
Many thanks in advance.<br>
-Uri<br>
<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>