From: Endlisnis 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 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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::Current()()', which is of non-aggregate type `int' t.cc(26) Warning: unused variable `int c' There were some errors ---------------------------------------------------- template class Node { public: T Data; }; template class List { Node* Curr; public: T Current(); }; int main(int argc, char *argv[]) { List 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 T List::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