This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Is This Really A Parse Error?
- To: gcc at egcs dot cygnus dot com
- Subject: Is This Really A Parse Error?
- From: Tom Larsen <tomar at eai dot com>
- Date: Wed, 21 Jul 1999 15:45:20 -0500
- Organization: Engineering Animation, Inc.
- Really-From: tomar@eai.com
EGCS ML,
I've hunted all over the documentation in an effort to clarify this
problem but have found none. The compile claims that this snippet of
psuedo-code is a parsing error...
template <class V,class K>
KeyedVec<V,K>::getIndex(const K& k)
{
...
static Hasher<V,K> hash(V(),K(),this); // Compiler says this is a
// error.
...
}
The compiler error says...
keyedvec.cpp:82: type specifier omitted for parameter
keyedvec.cpp:82: parse error before `this'
keyedvec.cpp:82: cannot declare static function inside another function
The way I currently get around this problem is by unfolding the
expression like this...
template <class V,class K>
KeyedVec<V,K>::getIndex(const K& k)
{
...
V vv;
K kk;
static Hasher<V,K> hash(vv,kk,this); // this seems to work.
...
}
Shouldn't the compiler be able to handle the syntax out of the
first snippet?
Thanks,
Tom Larsen
aka tomar@eai.com
--
Tom Larsen(Tomar)
aka: tomar@eai.com
E.A.I
http://www.eai.com