X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f From: Alex Vinokur Newsgroups: comp.os.msdos.djgpp,comp.lang.c++ Subject: Passing 'const' as 'this' discards qualifiers Date: Tue, 04 Dec 2001 15:25:56 +0200 Organization: Scopus Network Technologies Lines: 59 Message-ID: <3C0CCEE3.A2D60376@bigfoot.com> NNTP-Posting-Host: 62.90.123.5 Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit X-Trace: fu-berlin.de 1007472372 9116900 62.90.123.5 (16 [79865]) X-Mailer: Mozilla 4.7 [en] (Win98; I) X-Accept-Language: en To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com =============================================================== Windows98 gpp : GNU C++ version 2.95.3 20010315/djgpp (release) (djgpp) compiled by GNU C version 2.95.3 20010315/djgpp (release). =============================================================== Hi, A compiler detects error in program below. What is wrong in the program? //------------- C++ Code : BEGIN ------------- #include class AAA; class less_AAA { public: bool operator() (AAA& ins1, AAA& ins2) {return false;} }; class AAA { public: void foo1 () {}; }; int main () { set::iterator iter; iter->foo1(); // Line#20 return 0; } //-------------- C++ Code : END -------------- //------------- Compiling : BEGIN ------------ gpp ttt.c ttt.c: In function `int main()': ttt.c:20: passing `const AAA' as `this' argument of `void AAA::foo1()' discards qualifiers //-------------- Compiling : END ------------- =========================== Alex Vinokur mailto:alexvn AT bigfoot DOT com mailto:alexvn AT dr DOT com http://up.to/alexvn http://go.to/alexv_math ===========================