A c++ puzzle for you gurus

Joerg Sonnenberger joerg at britannica.bec.de
Wed Dec 13 16:14:17 PST 2006


On Wed, Dec 13, 2006 at 07:48:38AM -0800, walt wrote:
> c++ -O2 -I/usr/pkg/include -I/usr/include -Wall -O3  -I/usr/pkg/include
> -I/usr/include  -c -o syncres.o syncres.cc
> In file included from mtasker.hh:107,
>                  from syncres.hh:20,
>                  from syncres.cc:20:
> mtasker.cc: In member function `void MTasker<EventKey, EventVal>::yield()':
> mtasker.cc:196: error: there are no arguments to `swapcontext' that depend
> on a template parameter, so a declaration of `swapcontext' must be available

It means the call to swapcontext can't be resolved correctly as the
compiler doesn't know the template base type. Explictly add a this-> to
bind it to the current object's type.

> My bonehead compiler question is:  how did we get from 'from syncres.cc' to
> 'mtasker.cc' with no intermediate steps?

The error happens at the time of template instantiation.

Joerg





More information about the Users mailing list