Now I have problems with private classes:<br>* C is my main class;<br>* D is a private class declared inside C;<br>* if, inside a method of class C, I declare an object of class D and use it as parameter for another method, AspectC++ will generate invalid source code.<br>
<br>The problem is that AspectC++ generates a procedure to be called inside the first method, and this procedure can't access the private class D:<br><br>__attribute__((always_inline)) inline void __call__ZN1C3fooEv_0_0 (::C *srcthis, void (::C::* fptr)(::C::D *), ::C *dstthis, ::C::D * arg0){<br>
AC::invoke_AspC_AspC_a0_before ();<br> (dstthis->*fptr)(arg0);<br> }<br><br>---<br><br>The workaround is don't include methods that receive private classes as paremeters in your pointcuts:<br>...<br>pointcut methods () = call ("% C::%(...)" && ! "void C::foo (C::D*)");<br>
...<br><br>---<br><br>leandro.costa@hydrus:~/personal/aspects/bug2> more C.h C.cc C.ah<br>::::::::::::::<br>C.h<br>::::::::::::::<br>#ifndef _C_H_<br>#define _C_H_<br><br>class C<br>{<br> private:<br> class D { };<br>
<br> void foo ();<br> void foo (D *pD);<br>};<br><br>#endif<br>::::::::::::::<br>C.cc<br>::::::::::::::<br>#include "C.h"<br><br>void C::foo ()<br>{<br> D d;<br> foo (&d);<br>}<br><br>void C::foo (D *pD) { }<br>
::::::::::::::<br>C.ah<br>::::::::::::::<br>#ifndef _C_AH_<br>#define _C_AH_<br><br>aspect AspC<br>{<br> public:<br> pointcut methods () = call ("% C::%(...)");<br><br> advice methods () : before () { }<br>
};<br><br>#endif<br>leandro.costa@hydrus:~/personal/aspects/bug2> ac++ -v1 -k -p . --config puma.config -c C.cc -o C.acc -a C.ah<br>* Running ac++ 1.0pre4 svn<br>* Handling Translation Unit `C.cc'.<br>* Inserting unit pro- and epilogues<br>
* Updating #line directives of generated code fragments<br>* Saving<br>* Done<br>leandro.costa@hydrus:~/personal/aspects/bug2> g++ -O -x c++ -g -Wall -Werror -c C.acc -o C.o<br>C.h: In function `void __call__ZN1C3fooEv_0_0(C*, void (C::*)(C::D*), C*,<br>
C::D*)':<br>C.h:7: error: `class C::D' is private<br>C.acc:134: error: within this context<br>C.h:7: error: `class C::D' is private<br>C.acc:134: error: within this context<br>leandro.costa@hydrus:~/personal/aspects/bug2><br>
<br><br clear="all"><br>-- <br>_____________________________________________<br><br> Leandro Souza Costa<br><br>"A vitória se encastela em jardins encantadores,<br> mas para se chegar a ela não há caminho de flores"<br>
_____________________________________________<br>