This works fine
const void* getObjHandle() {
return (const void*)hdl;
}
But the below gives ignored-qualifiers warning.
error: type qualifiers ignored on function return type [-Werror=ignored-qualifiers]
typedef void* objHandle;
const objHandle getObjHandle() {
return (const objHandle)hdl;
}
The below one gives an invalid static_cast error along with the ignored-qualifiers warning
error: invalid static_cast from type ‘const Object*’ to type ‘const objHandle {aka void* const}’
typedef void* objHandle;
const objHandle getObjHandle() {
return static_cast<const objHandle>(hdl);
}
The below one works again
typedef void* objHandle;
const void* getObjHandle() {
return static_cast<const void*>(hdl);
}
hdl is a const pointer to an object I am getting from another helper inside getObjHandle(). Why are these warnings/errors coming? How can I get rid of them without getting rid of the typedefs.