From: andy <andy@softbook.com>
To: <gcc-help@gcc.gnu.org>
Subject: Re: template problem
Date: Wed, 09 Oct 2002 11:46:00 -0000 [thread overview]
Message-ID: <B9C9C775.73E7%andy@softbook.com> (raw)
In-Reply-To: <2F05A390F72A0A409390E016D23E45E8042DBE10@ns-bco-mse4.im.battelle.org>
Thanks to all who responded.
typename did indeed fix it.
Regards
Andy
On 10/9/02 10:12 AM, "Moore, Mathew L" wrote:
> The compiler doesn't realize that _DataType is a typename within DataClass
> (it could, after all, be a function or variable), so you have to explicitly
> tell it. This is accomplished using the "typename" keyword:
>
> template <class FilterClass, class DataClass>
> class P2PassScale
> {
> public:
> typedef typename DataClass::_DataType _DataType;
> ...
>
>
>
>> -----Original Message-----
>> From: andy [mailto:andy@softbook.com]
>> Sent: Wednesday, October 09, 2002 12:34
>> To: gcc-help@gcc.gnu.org
>> Subject: template problem
>>
>>
>> I'm having trouble compiling the following in gcc3.2:
>>
>> template <class FilterClass, class DataClass = CDataCOLORREF>
>>
>> class C2PassScale
>> {
>> public:
>> typedef DataClass::_DataType _DataType; //ERROR -see below
>> typedef DataClass::_RowType _RowType;
>> ....
>>
>>
>> //class CDataCOLORREF is declared below in the same file
>> class CDataCOLORREF {
>> public:
>> typedef unsigned long_DataType;
>> ....
>>
>> ERROR above reads:
>> "ISO C++ forbids declaration of _DataType with no type"
>>
>> Now, if I understand the code correctly, the _DataType
>> variable of the
>> C2PassScale class is typedef'ed to be the same as _DataType
>> variable of the
>> the CDataCOLORREF class, i.e, long.
>> It looks like gcc cannot figure out what type the _DataType
>> variable of
>> C2PassScale class needs to be.
>> I wonder if anyone can help finding a workaround or maybe a
>> compile option I
>> need to turn on
>>
>> Thanks in advance
>> Andy
>>
>>
next parent reply other threads:[~2002-10-09 18:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <2F05A390F72A0A409390E016D23E45E8042DBE10@ns-bco-mse4.im.battelle.org>
2002-10-09 11:46 ` andy [this message]
2002-10-09 9:33 andy
2002-10-09 10:18 ` Eljay Love-Jensen
-- strict thread matches above, loose matches on Subject: below --
2001-04-02 7:20 Template problem jpyubero
2001-04-02 21:00 ` Alexandre Oliva
1999-12-28 13:11 Michael Ben-Gershon
1999-12-31 22:24 ` Michael Ben-Gershon
2000-01-02 4:22 ` Alex Vinokur
2000-04-01 0:00 ` Alex Vinokur
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=B9C9C775.73E7%andy@softbook.com \
--to=andy@softbook.com \
--cc=gcc-help@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).