Boost logo

Boost :

From: Andreas Huber (ahd6974-spamgroupstrap_at_[hidden])
Date: 2006-03-09 18:02:14


David Greene wrote:
> Oliver.Kowalke_at_[hidden] wrote:
>> Hello,
>> the code below doesn't compile (gcc-3.4.6 on Linux).
>> 'transit in scope not defined'
>> Any glue?
>> Regards,
>> Oliver
>
>> { return transit< Z< S > >(); } <<=== error
>
> Try { return this->template transit< Z< S > >(); }
>
> Can anyone comment on whay this is necessary? Is it standard
> behavior or a gcc limitation?

It's standard behavior, dependent name lookup in templates. I faintly
remember an article that explained the problem really nicely but can't
find it right now. In a nutshell, when going through the template the
compiler cannot know whether transit< Z< S > >() is a call to a member
function of the base class or a call to a ctor of a class template.
IIRC, this is because of possible template specializations of the base
class.

> gcc 4 has the same issue. If
> it is standard behavior, then the statechart docs need to be
> updated to reflect that because right now they don't include
> the "this->template " part.

You mean an example doesn't use that syntax? I'd be grateful for a
pointer.

Thanks & Regards,

-- 
Andreas Huber
When replying by private email, please remove the words spam and trap
from the address shown in the header. 

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk