Mail Archives: djgpp/1999/03/02/23:51:18.1
From: | Endlisnis <s257m AT unb DOT ca>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | GCC thinks there is an error when I don't.
|
Date: | Tue, 02 Mar 1999 23:44:06 -0400
|
Organization: | BrunNet
|
Lines: | 54
|
Message-ID: | <36DCB006.56317EDC@unb.ca>
|
NNTP-Posting-Host: | ftnts2c4.brunnet.net
|
Mime-Version: | 1.0
|
X-Mailer: | Mozilla 4.04 [en] (Win95; U)
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
I get this error when I compile the code given. I've narrowed the code
down to the smallest example that exibits the problem. I'm not sure what
"aggregate type" means. But the lvalue is an 'int' and the rvalue is an
'int'. So I don't understand what is wrong. I'm working with gcc v2.8.1.
Here is the output [from within RHIDE].
----------------------------------------------------
Compiling: t.cc
In function `int main(int, char **)':
t.cc(26) Error: request for member `Data' in `b.List<int>::Current()()', which
is of non-aggregate type `int'
t.cc(26) Warning: unused variable `int c'
There were some errors
----------------------------------------------------
template <class T>
class Node
{
public:
T Data;
};
template <class T>
class List
{
Node<T>* Curr;
public:
T Current();
};
int main(int argc, char *argv[])
{
List<int> b;
int c = b.Current().Data;
/*Note this line. It is assigning an 'int' to an 'int', but the compiler
gets an error. */
return 0;
}
template <class T>
T List<T>::Current()
{
return Curr->Data;
}
--
(\/) Endlisnis (\/)
s257m AT unb DOT ca
Endlisnis AT GeoCities DOT com
Endlisnis AT BrunNet DOT Net
Endlisnis AT HotMail DOT com
- Raw text -