Mail Archives: djgpp/1997/02/25/17:16:02
Consider this source code:
signature Foosig {
void Test() const; // (1)
};
class Foo {
public:
void Test() const { // (2)
// Testing Foo
}
};
main()
{
Foo f;
Foosig *fsp = &f;
fsp->Test();
return 0;
}
When I try to compile this (with the -fhandle-signatures flag,
obviously) I get the following error:
sig.cc:17: call to non-const method `void Foosig::Test() const' with
const object
This error message seems to contradict itself since it says I am calling
a non-const method, and then names the method as const. If I remove the
const labelled (1) in the code it then compiles fine even though, to me,
method (2) no longer matches the signature method (1). Is this a bug,
or am I doing something wrong?
Thanks for your time,
Ewan Mellor.
- Raw text -