I had the following C++ code, where the argument to my constructor in the declaration had different constness than the definition of the constructor.
//testClass.hpp
class testClass {
public:
testClass(const int *x);
};
//testClass.cpp
testClass::testClass(const int * const x) {}
I was able to compile this with no warnings using g++, should this code compile or at least give some warnings? It turns out that the built-in C++ compiler on 64 bit solaris gave me a linker error, which is how I noticed that there was an issue.
What is the rule on matching arguments in this case? Is it up to compilers?