diff --git a/icu4c/source/common/unifiedcache.h b/icu4c/source/common/unifiedcache.h index 61609cf125f..e01d1e6232f 100644 --- a/icu4c/source/common/unifiedcache.h +++ b/icu4c/source/common/unifiedcache.h @@ -38,7 +38,7 @@ class U_COMMON_API CacheKeyBase : public UObject { * Copy constructor. Needed to support cloning. */ CacheKeyBase(const CacheKeyBase &other) - : creationStatus(other.creationStatus) { } + : UObject(other), creationStatus(other.creationStatus) { } virtual ~CacheKeyBase(); /** @@ -135,6 +135,8 @@ class LocaleCacheKey : public CacheKey { Locale fLoc; public: LocaleCacheKey(const Locale &loc) : fLoc(loc) {}; + LocaleCacheKey(const LocaleCacheKey &other) + : CacheKey(other), fLoc(other.fLoc) { } virtual ~LocaleCacheKey() { } virtual int32_t hashCode() const { return 37 *CacheKey::hashCode() + fLoc.hashCode(); diff --git a/icu4c/source/test/intltest/tsmthred.cpp b/icu4c/source/test/intltest/tsmthred.cpp index 0e687cf6a62..56adf201605 100644 --- a/icu4c/source/test/intltest/tsmthred.cpp +++ b/icu4c/source/test/intltest/tsmthred.cpp @@ -1716,6 +1716,8 @@ class UCTMultiThreadItem : public SharedObject { } }; +U_NAMESPACE_BEGIN + template<> U_EXPORT const UCTMultiThreadItem *LocaleCacheKey::createObject( const void * /*unused*/, UErrorCode & /* status */) const { @@ -1739,6 +1741,8 @@ const UCTMultiThreadItem *LocaleCacheKey::createObject( return result; } +U_NAMESPACE_END + class UnifiedCacheThread: public SimpleThread { public: UnifiedCacheThread(const char *loc) : fLoc(loc) {}; diff --git a/icu4c/source/test/intltest/unifiedcachetest.cpp b/icu4c/source/test/intltest/unifiedcachetest.cpp index 004d728cbc3..042f1a09ffc 100644 --- a/icu4c/source/test/intltest/unifiedcachetest.cpp +++ b/icu4c/source/test/intltest/unifiedcachetest.cpp @@ -26,6 +26,8 @@ class UCTItem : public SharedObject { class UCTItem2 : public SharedObject { }; +U_NAMESPACE_BEGIN + template<> U_EXPORT const UCTItem *LocaleCacheKey::createObject( const void * /*unused*/, UErrorCode &status) const { @@ -52,6 +54,9 @@ const UCTItem2 *LocaleCacheKey::createObject( return NULL; } +U_NAMESPACE_END + + class UnifiedCacheTest : public IntlTest { public: UnifiedCacheTest() {