Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
0.10.0
-
None
-
None
-
OS: linux
gcc: 3.4.4
Description
In the template "template<typename T> class ObjectPtrT" in file "include/log4cxx/helpers/objectptr.h"
the function "template<typename InterfacePtr> void cast(const InterfacePtr& p1)" uses an "unsafe" cast to (T*).
This triggers a gcc warning because the "const" qualifier gets casted away.
I tried the following:
template<typename InterfacePtr> void cast(const InterfacePtr& p1)
{
- T* newPtr = 0;
+ const T* newPtr = 0;
if (p1 != 0) { - newPtr = (T*)p1->cast(T::getStaticClass()); + newPtr = (const T*)p1->cast(T::getStaticClass()); }operator=(newPtr);
}
This compiles but the unittests fail.
In a comment to issue LOGCXX-14 another solution is provided:
https://issues.apache.org/jira/browse/LOGCXX-14#action_12315059