jj@idris.id.dk (Jesper Joergensen [ris]) (01/11/90)
ATTN: Michael Tiemann
Hi again,
I have just located another bug in the compiler and found the erroneous piece
of code as well. This time it was no trouble locating the error, since no
debugging was required.
We are talking: G++ version 1.36.1
configured for: vax (BSD machines)
running under: Ultrix V2.2-1 Worksystem V1.1 System #2
running on a: DEC VAXstation 2000
The function we're talking about is `report_type_mismatch' in file
`cplus-method.c' where lines 1292 to 1295 says:
1292: if (TREE_READONLY (TREE_TYPE (TREE_VALUE (parmtypes))))
1293: error ("call to const %s `%s' with non-const object", name_kind, err_name);
1294: else
1295: error ("call to non-const %s `%s' with const object", name_kind, err_name);
These two error messages should be swapped or the condition reversed, since
TREE_READONLY must mean the object is const (i.e. the method isn't). I
actually don't see any use for the first error message (1293), since calling
a const method with a non-const object is not forbidden (isn't it a compiler
error).
I got the message while attempting to call a non-const method within a const
member function (in which the *this object is const of course).
Will this error be corrected in version 1.36.2 or is it too late ???
If it is not part of version 1.36.2 can I then patch it myself as I have
described here ???
Thanks for your attention (hope I'm not wrong &:^)
Jesper Jorgensen jj@idris.id.dk
Research associate
Department of Computer Science
Technical University of Denmark
DK-2800 Lyngby
DENMARK