I have a syntax error that is puzzling
Previous code:
class A {
public:
void process(const string& str) {};
};
I have
A a;
a.process("abcd");
all is well now I change the process member function to a const
void process(const string& str) const {};
and now
a.process("abcd");
get a compile error about str being a const char[5]...
How the const addition impact the syntax error. I thought const only (in this context) meant that the member variables will not change?
Thoughts on this?
Adding a const
to the end of the method declaration would not have changed the semantics of the str
parameter. Either something else is happening, or the compiler has a bug.