[aspectc-user] advice not working with std::string default argument

Timothy Stack stack at cs.utah.edu
Mon Mar 12 01:42:36 CET 2007


Hi,

I seem to be having trouble getting an advice to apply to a method  
with a string default argument.  If I change the argument to an  
integer with a default value, it works, but no joy the other way.   
Here's an example:

actest.cc:
   #include <stdio.h>

   #include <string>

   class actest {
   public:

       unsigned int mymethod(const std::string msg = "")
       {
	  return printf("%s\n", msg.c_str());
       };
   };

   class accaller {
   public:
       void foo() {
	  actest ac;
	
	  ac.mymethod();
       };
   };

actest.ah:
   #include <stdio.h>

   aspect AcDefTest {
       advice call("% actest::mymethod(...)") && within("accaller") :  
before() {
	  printf("Hello, World!\n");
       };
   };

Looking at the generated .acc file, the 'ac.mymethod()' call wasn't  
transformed like I had expected.

thanks,

tim stack




More information about the aspectc-user mailing list