This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
I'm having trouble compiling some files with template classes in them.
Here is a sample program:
-------------------------
1
2 template<class
BASE_CLASS, class KEY, class VALUE>
3 class
CTypedPtrMap : public BASE_CLASS
4 {
5 public:
6
int Lookup( BASE_CLASS::BASE_ARG_KEY key, VALUE& rValue) const
7
{ return BASE_CLASS::Lookup(key, ( BASE_CLASS::BASE_VALUE&)rValue);
}
8 };
---------------------
When I try to compile this, I get:
u.C:6: parse error before `,'
u.C: In method `int CTypedPtrMap<BASE_CLASS,KEY,VALUE>::Lookup(...)
const':
u.C:7: parse error before `)'
Apparently the compiler is trying to syntax check this before it is
actually instantiated. At
instantiation time, the "BASE_CLASS"
has in it:
protected:
typedef int
BASE_ARG_KEY;
typedef void*
BASE_VALUE;
The Sun Solaris 6.0 compiler, and NT's Visual Studio C++ 6.0 compile
this without
complaint but g++ does not.
I have looked at all of the compiler switches and tried all of them
that seem to have anything
to do with template instantiation without success.
Does anyone out there have a "fix" for this or a worksround? ... Thanks...
Don Mies
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |