Author: carnold
Date: Thu Nov 8 14:43:51 2007
New Revision: 593346
URL: http://svn.apache.org/viewvc?rev=593346&view=rev
Log:
LOGCXX-202: Inconsistent const-ness in ObjectPtrT
Modified:
logging/log4cxx/trunk/src/main/include/log4cxx/helpers/objectptr.h
logging/log4cxx/trunk/src/test/cpp/loggertestcase.cpp
Modified: logging/log4cxx/trunk/src/main/include/log4cxx/helpers/objectptr.h
URL:
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/main/include/log4cxx/helpers/objectptr.h?rev=593346&r1=593345&r2=593346&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/main/include/log4cxx/helpers/objectptr.h
(original)
+++ logging/log4cxx/trunk/src/main/include/log4cxx/helpers/objectptr.h Thu Nov
8 14:43:51 2007
@@ -137,8 +137,7 @@
bool operator!=(const ObjectPtrT& p1) const { return (this->p !=
p1.p); }
bool operator==(const T* p1) const { return (this->p == p1); }
bool operator!=(const T* p1) const { return (this->p != p1); }
- T* operator->() {return (T*) p; }
- const T* operator->() const {return (const T*) p; }
+ T* operator->() const {return (T*) p; }
T& operator*() const {return (T&) *p; }
operator T*() const {return (T*) p; }
Modified: logging/log4cxx/trunk/src/test/cpp/loggertestcase.cpp
URL:
http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/test/cpp/loggertestcase.cpp?rev=593346&r1=593345&r2=593346&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/test/cpp/loggertestcase.cpp (original)
+++ logging/log4cxx/trunk/src/test/cpp/loggertestcase.cpp Thu Nov 8 14:43:51
2007
@@ -397,6 +397,19 @@
LoggerPtr a11 = h->getLogger(LOG4CXX_STR("a"));
CPPUNIT_ASSERT_EQUAL(a0, a11);
}
+
+ void compileTestForLOGCXX202() const {
+ //
+ // prior to fix, these line would compile.
+ //
+ (*logger).info("Hello, World.");
+ ((Logger*) logger)->info("Hello, World.");
+ //
+ // this one would not.
+ //
+ logger->info("Hello, World.");
+ }
+
protected:
static LogString MSG;