[aspectc-user] error when using templates in aspects

gabrielalexm at yahoo.com gabrielalexm at yahoo.com
Wed Feb 1 16:22:36 CET 2006

I want to try some of the generative programming ideas
as described in the SD Journal article and I found a
I can reproduce it with these two files:
-------- hello.cpp -------------
#include <iostream>

int main () {
    std::cout << "Hello World!" << std::endl;
-------- end hello.cpp ---------

-------- myAspect.ah -----------
#include <iostream>

aspect myAspect {

	template<class TJP>
	class MyClass {

    advice execution( "% main(...)" ) : before () {
      std::cout << "Hello Aspect! " <<
JoinPoint::signature() << std::endl;
-------- end myAspect.ah -------

I'm compiling this using ac-1.0pre2 on Linux, using
the command line:
ag++ hello.cpp -o hello
I get the following error:
hello.acc:182: error: ‘class myAspect’ has the same
name as the class in which it is declared

If I comment the template definition out, it compiles
and works fine.

What am I doing wrong?


Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

More information about the aspectc-user mailing list