[aspectc-user] calls to template members not matched
Olaf Spinczyk
Olaf.Spinczyk at informatik.uni-erlangen.de
Fri Jan 5 12:25:21 CET 2007
Hello,
you are right, your example code should work. However, template analysis
is only activated if you use the ac++ option --real-instances. I haven't
tried it with your code, but I am optimistic that this solves the problem.
On the other hand --real-instances sometimes leads to parsing problems
if your code is more complex. Therefore, it is not the default parser
mode yet.
BTW, when I experimented with your code in the ACDT, I found out that it
is not possible to set the --real-instances option in a "managed make"
project. This would be an improvement that Rainer should consider for
his next ACDT release ...
I keep my fingers crossed that --real-instances works with your real code.
Best regards,
Olaf
Panu Bloigu wrote:
> Hello.
>
> I've understood that weaving in template code isn't yet implemented in ac++
> 1.0pre3. However, on May 26th 2006 Olaf said on the list that:
>
>> I'm sorry, but weaving *in* templates still does not work. The only
>> template-related feature that should work, although experimental, is
>> advice for calls to member functions of template instances, if the call
>> itself is not located within the template. For example, if there is a
>> call to Client<Something>::run() within your main() function, call
>> advice should work.
>
> I don't seem to be able to get even this to work. Again, please consider the
> three following files I have:
>
> ===================
> File 1: ClassA.h
> ===================
> ifndef CLASSA_H_
> #define CLASSA_H_
> #include <iostream>
> template<class T>class ClassA
> {
> public:
> ClassA();
> virtual ~ClassA();
> void m();
> };
> template<class T> ClassA<T>::ClassA(){}
> template<class T> ClassA<T>::~ClassA(){}
> template<class T> void ClassA<T>::m()
> {
> std::cout<<"ClassA::m() called!\n";
> }
> #endif /*CLASSA_H_*/
>
> ===================
> File 2: main.cpp
> ===================
> #include "ClassA.h"
> int main()
> {
> ClassA<int> a;
> a.m();
> return 0;
> }
>
> ===================
> File 3: AnAspect.ah
> ===================
> #ifndef ANASPECT_AH_
> #define ANASPECT_AH_
> #include <iostream>
> aspect AnAspect
> {
> advice call("void ClassA<...>::m()") : around()
> {
> std::cout<<"Before call\n";
> tjp->proceed();
> std::cout<<("After call\n");
> }
> };
> #endif /*ANASPECT_AH_*/
>
> ================================================================================
>
> With the above shown three files, the call pointcut in AnAspect isn't
> matched. I'm starting to suspect there's something wrong with my code,
> because from Olaf's post I've understood that this should work.
>
> So, is there something wrong with my code or do I have misinterpreted what
> Olaf had said? At this point it would be a great feature to have at least
> the calls to template code working.
>
> Thanks in advance,
>
> Panu.
>
>
>
> _______________________________________________
> aspectc-user mailing list
> aspectc-user at aspectc.org
> http://www.aspectc.org/mailman/listinfo/aspectc-user
More information about the aspectc-user
mailing list