Jonathon; There is a indentation in my forhead where I said "I knew that". thanks art ----- Original Message ---- From: Jonathan Wakely <jwakely.gcc@xxxxxxxxx> To: Arthur Schwarz <aschwarz1309@xxxxxxx> Cc: gcc-help@xxxxxxxxxxx Sent: Sun, October 14, 2012 2:20:21 PM Subject: Re: Inconsisten error messages on const pointers On 14 October 2012 21:33, Arthur Schwarz wrote: > In the example below the following two statements seem to be inconsistent: > 1: cout << " " << endl << cell1->dump(); > 2: this->message += cell1->dump(); > > 1: produces the error message > SlipException.h: In member function ‘void slip::SlipException::log()’: > In file included from SlipCell.h:49:0, > from SlipDatum.h:269, > from SlipOp.h:22, > from SlipStringOp.h:12, > from SlipStringOP.cpp:11: > SlipException.h:29:79: error: passing ‘const slip::SlipCellBase’ as ‘this’ > argument of ‘virtual std::string slip::SlipCellBase::dump()’ discards >qualifiers > > With 2: there is no diagnostic message. Any reason why? In 1 'cell1' refers to this->cell1 which is a const SlipCellBase*, so you can't call the non-const dump function In 2 'cell1' refers to the constructor argument, which has type SlipCellBase*, so you can call the non-const function.