[aspectc-user] const functions

Olaf Spinczyk Olaf.Spinczyk at informatik.uni-erlangen.de
Tue May 27 16:45:56 CEST 2003


Hi Sven,

Sven.Apel at metop-md.de wrote:
> Hallo,
> 
> I get an error when I try to refer (inside a pointcut) to a constant
> function:
> 
> class Attribute
> {
> 	...
> 	Value Get() const {return m_value;}
> };
> 
> aspect TupleLockAspect
> {
> 	pointcut locking() =	execution("% Attribute::Get(...)");
> };
> 
> the error message:
> 
> ./ac_gen.cc(238): error C2440: 'Initialisierung' : 'const Attribute
> *const ' kann nicht in 'void *' konvertiert werden
> 
> What is the problem?
> 
> best regards
> Sven

this looks like Bug 76 in our Bugzilla system. In the generated code the 
'this' pointer is assigned to a 'void*' variable. This is not allowed by 
the back-end C++ compiler if the object, which is referenced by 'this', 
is constant. That only happens if your advice code accesses 'thisJoinPoint'.

The bug isn't fixed yet. Meanwhile you can only try to avoid using 
thisJoinPoint in that particular advice or make the function 
non-constant :-(.

Yours,

Olaf





More information about the aspectc-user mailing list