Subject: Re: C++ problem: building "pkgsrc/audio/daapd" with GCC 4.x
To: None <tech-pkg@NetBSD.org>
From: Matthias Scheler <tron@zhadum.org.uk>
List: tech-pkg
Date: 07/01/2006 11:06:29
In article <20060701082740.GB360@britannica.bec.de>,
	joerg@britannica.bec.de writes:
>> void TypeRegistry::registerVar( const Var* var ) {
>>         varMap[var->name] = var;
>>         container << Tag( 'mdcl' ) <<
>>                 Tag( 'mcnm' ) << var->mnemonic  << end <<
>>                 Tag( 'mcna' ) << var->name      << end <<
>>                 Tag( 'mcty' ) << (u16)var->type << end <<
>>         end;
>> }
> 
> I guess: TypeRegistry is a template class ...

It is indeed.

> ... and end doesn't depend on the template parameter.

Shouldn't TypeRegistry::End work in that case? Unfortunately it doesn't.

> Try this->end instead.

That doesn't work because it's a static member:

registry.cpp: In static member function 'static void TypeRegistry::registerVar(const TypeRegistry::Var*)':
registry.cpp:134: error: 'this' is unavailable for static member functions
registry.cpp:135: error: 'this' is unavailable for static member functions
registry.cpp:136: error: 'this' is unavailable for static member functions
registry.cpp:137: error: 'this' is unavailable for static member functions

There is only one thing which is worse than fixing old C code to compile
with GCC 4.x: fixing old C++ code to do the same.

	Kind regards

-- 
Matthias Scheler                                  http://scheler.de/~matthias/