diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index 21c83c6694c51df83080330f7f760b8faea79395..454d99ba4ffc493a7b817fe6c379e402a3dfe2a6 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -49,3 +49,5 @@ Non-Google patch contributors:
       text format.
   Brian Atkinson <nairb774@gmail.com>
     * Added @Override annotation to generated Java code where appropriate.
+  Vincent Choinière <Choiniere.Vincent@hydro.qc.ca>
+    * Tru64 support.
diff --git a/README.txt b/README.txt
index 8e9dd06781883e72b20fc49fed367bbcf1c856bb..8b7c8531e3460650eb08681134c54dfef66113b8 100644
--- a/README.txt
+++ b/README.txt
@@ -21,7 +21,7 @@ Proceed at your own risk.
 
 For advanced usage information on configure and make, see INSTALL.txt.
 
-** Hint on insall location **
+** Hint on install location **
 
   By default, the package will be installed to /usr/local.  However,
   on many platforms, /usr/local/lib is not part of LD_LIBRARY_PATH.
@@ -43,6 +43,14 @@ For advanced usage information on configure and make, see INSTALL.txt.
 
   See src/solaris/libstdc++.la for more info on this bug.
 
+** Note for HP C++ Tru64 users **
+
+  To compile invoke configure as follows:
+
+    ./configure CXXFLAGS="-O -std ansi -ieee -D__USE_STD_IOSTREAM"
+
+  Also, you will need to use gmake instead of make.
+
 C++ Installation - Windows
 ==========================
 
diff --git a/src/google/protobuf/compiler/cpp/cpp_unittest.cc b/src/google/protobuf/compiler/cpp/cpp_unittest.cc
index 1807b595f1651cab39f1cae757aa7c046178bd4c..ce7d0c88258226c78198beac4aae4dbdb5d1b001 100644
--- a/src/google/protobuf/compiler/cpp/cpp_unittest.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_unittest.cc
@@ -67,7 +67,8 @@ namespace protobuf {
 namespace compiler {
 namespace cpp {
 
-namespace {
+// Can't use an anonymous namespace here due to brokenness of Tru64 compiler.
+namespace cpp_unittest {
 
 
 class MockErrorCollector : public MultiFileErrorCollector {
@@ -854,7 +855,7 @@ TEST_F(GeneratedServiceTest, NotImplemented) {
   EXPECT_TRUE(controller.called_);
 }
 
-}  // namespace
+}  // namespace cpp_unittest
 
 }  // namespace cpp
 }  // namespace compiler
diff --git a/src/google/protobuf/descriptor.cc b/src/google/protobuf/descriptor.cc
index b843a06b8b3f21017b3ef0d39b4bce48f01a9a25..882b104b8870c6155b3456b869158a96823e3e3e 100644
--- a/src/google/protobuf/descriptor.cc
+++ b/src/google/protobuf/descriptor.cc
@@ -1175,8 +1175,13 @@ void Descriptor::CopyTo(DescriptorProto* proto) const {
 void FieldDescriptor::CopyTo(FieldDescriptorProto* proto) const {
   proto->set_name(name());
   proto->set_number(number());
-  proto->set_label(static_cast<FieldDescriptorProto::Label>(label()));
-  proto->set_type(static_cast<FieldDescriptorProto::Type>(type()));
+
+  // Some compilers do not allow static_cast directly between two enum types,
+  // so we must cast to int first.
+  proto->set_label(static_cast<FieldDescriptorProto::Label>(
+                     implicit_cast<int>(label())));
+  proto->set_type(static_cast<FieldDescriptorProto::Type>(
+                    implicit_cast<int>(type())));
 
   if (is_extension()) {
     proto->set_extendee(".");
@@ -2487,10 +2492,15 @@ void DescriptorBuilder::BuildFieldOrExtension(const FieldDescriptorProto& proto,
   result->full_name_    = full_name;
   result->file_         = file_;
   result->number_       = proto.number();
-  result->type_         = static_cast<FieldDescriptor::Type>(proto.type());
-  result->label_        = static_cast<FieldDescriptor::Label>(proto.label());
   result->is_extension_ = is_extension;
 
+  // Some compilers do not allow static_cast directly between two enum types,
+  // so we must cast to int first.
+  result->type_  = static_cast<FieldDescriptor::Type>(
+                     implicit_cast<int>(proto.type()));
+  result->label_ = static_cast<FieldDescriptor::Label>(
+                     implicit_cast<int>(proto.label()));
+
   // Some of these may be filled in when cross-linking.
   result->containing_type_ = NULL;
   result->extension_scope_ = NULL;
diff --git a/src/google/protobuf/descriptor_unittest.cc b/src/google/protobuf/descriptor_unittest.cc
index c919b80d85e5209ff2540a635cac5652349968bd..b7dac69ad6c5e9072742acf6c3ac86bd36abc74b 100644
--- a/src/google/protobuf/descriptor_unittest.cc
+++ b/src/google/protobuf/descriptor_unittest.cc
@@ -53,7 +53,7 @@
 namespace google {
 namespace protobuf {
 
-namespace {
+namespace GOOGLE_ANONYMOUS_NAMESPACE{
 
 // Some helpers to make assembling descriptors faster.
 DescriptorProto* AddMessage(FileDescriptorProto* file, const string& name) {
@@ -1323,7 +1323,7 @@ class MiscTest : public testing::Test {
     DescriptorProto* message = AddMessage(&file_proto, "TestMessage");
     FieldDescriptorProto* field =
       AddField(message, "foo", 1, FieldDescriptorProto::LABEL_OPTIONAL,
-               static_cast<FieldDescriptorProto::Type>(type));
+               static_cast<FieldDescriptorProto::Type>(static_cast<int>(type)));
 
     if (type == FieldDescriptor::TYPE_MESSAGE ||
         type == FieldDescriptor::TYPE_GROUP) {
diff --git a/src/google/protobuf/io/zero_copy_stream_impl.cc b/src/google/protobuf/io/zero_copy_stream_impl.cc
index 10071054c13364d59e3b78069d301805103c6231..04d573e1e6ccf9f49ebbf345b0ae56663498d84c 100644
--- a/src/google/protobuf/io/zero_copy_stream_impl.cc
+++ b/src/google/protobuf/io/zero_copy_stream_impl.cc
@@ -42,6 +42,8 @@
 #endif
 #include <errno.h>
 #include <iostream>
+#include <algorithm>
+
 #include <google/protobuf/io/zero_copy_stream_impl.h>
 #include <google/protobuf/stubs/common.h>
 #include <google/protobuf/stubs/stl_util-inl.h>
diff --git a/src/google/protobuf/message.h b/src/google/protobuf/message.h
index 65419365ee8ec7fc3045fded378c47f1130e069b..cd25faa2fc50ba9dcb8a9ca4ca67192569782630 100644
--- a/src/google/protobuf/message.h
+++ b/src/google/protobuf/message.h
@@ -110,7 +110,14 @@
 
 #include <vector>
 #include <string>
+
+#ifdef __DECCXX
+// HP C++'s iosfwd doesn't work.
+#include <iostream>
+#else
 #include <iosfwd>
+#endif
+
 #include <google/protobuf/stubs/common.h>
 
 namespace google {
diff --git a/src/google/protobuf/repeated_field.cc b/src/google/protobuf/repeated_field.cc
index ca0033cb1e8981f783079981d6dda14d282c0512..2d5cb0a402a70ffb68044858bd969269757f0be0 100644
--- a/src/google/protobuf/repeated_field.cc
+++ b/src/google/protobuf/repeated_field.cc
@@ -36,6 +36,12 @@
 
 namespace google {
 namespace protobuf {
+
+// HP C++ on Tru64 can't handle the stuff below being defined out-of-line, so
+// on that platform everything is defined in repeated_field.h.  On other
+// platforms, we want these to be out-of-line to avoid code bloat.
+#if !defined(__DECCXX) || !defined(__osf__)
+
 namespace internal {
 
 GenericRepeatedField::~GenericRepeatedField() {}
@@ -50,6 +56,7 @@ void RepeatedPtrField<string>::Clear() {
   current_size_ = 0;
 }
 
-}  // namespace protobuf
+#endif  // !defined(__DECCXX) || !defined(__osf__)
 
+}  // namespace protobuf
 }  // namespace google
diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h
index c81d27efe987f282823d214c4baa276e4b339e40..203aa9bfad00e162c92c03ae690e4d9ea5d6a625 100644
--- a/src/google/protobuf/repeated_field.h
+++ b/src/google/protobuf/repeated_field.h
@@ -69,7 +69,12 @@ namespace internal {
 class LIBPROTOBUF_EXPORT GenericRepeatedField {
  public:
   inline GenericRepeatedField() {}
+#if defined(__DECCXX) && defined(__osf__)
+  // HP C++ on Tru64 has trouble when this is not defined inline.
+  virtual ~GenericRepeatedField() {}
+#else
   virtual ~GenericRepeatedField();
+#endif
 
  private:
   // We only want GeneratedMessageReflection to see and use these, so we
@@ -516,9 +521,20 @@ void RepeatedPtrField<Element>::Clear() {
   current_size_ = 0;
 }
 
+#if defined(__DECCXX) && defined(__osf__)
+// HP C++ on Tru64 has trouble when this is not defined inline.
+template <>
+inline void RepeatedPtrField<string>::Clear() {
+  for (int i = 0; i < current_size_; i++) {
+    elements_[i]->clear();
+  }
+  current_size_ = 0;
+}
+#else
 // Specialization defined in repeated_field.cc.
 template <>
 void LIBPROTOBUF_EXPORT RepeatedPtrField<string>::Clear();
+#endif
 
 template <typename Element>
 void RepeatedPtrField<Element>::MergeFrom(const RepeatedPtrField& other) {
@@ -698,9 +714,16 @@ class RepeatedPtrIterator
               typename internal::remove_pointer<It>::type>::type> {
  public:
   typedef RepeatedPtrIterator<It> iterator;
-  typedef typename iterator::reference reference;
-  typedef typename iterator::pointer pointer;
-  typedef typename iterator::difference_type difference_type;
+  typedef std::iterator<
+          std::random_access_iterator_tag,
+          typename internal::remove_pointer<
+              typename internal::remove_pointer<It>::type>::type> superclass;
+
+  // Let the compiler know that these are type names, so we don't have to
+  // write "typename" in front of them everywhere.
+  typedef typename superclass::reference reference;
+  typedef typename superclass::pointer pointer;
+  typedef typename superclass::difference_type difference_type;
 
   RepeatedPtrIterator() : it_(NULL) {}
   explicit RepeatedPtrIterator(const It& it) : it_(it) {}
diff --git a/src/google/protobuf/stubs/common.h b/src/google/protobuf/stubs/common.h
index 05c15d1b00a376c54be8a481f444b1bbc7d20291..858d97fa30a58d06cfdedb8383fefe22d3aa79d8 100644
--- a/src/google/protobuf/stubs/common.h
+++ b/src/google/protobuf/stubs/common.h
@@ -40,7 +40,11 @@
 #include <cstddef>
 #include <string>
 #include <string.h>
-#ifndef _MSC_VER
+#if defined(__osf__)
+// Tru64 lacks stdint.h, but has inttypes.h which defines a superset of
+// what stdint.h would define.
+#include <inttypes.h>
+#elif !defined(_MSC_VER)
 #include <stdint.h>
 #endif
 
diff --git a/src/google/protobuf/stubs/strutil.cc b/src/google/protobuf/stubs/strutil.cc
index d3407fafffdb097e28af97700d8961f0b7458f69..bc4173442de81421973f49e3a345819075bcc178 100644
--- a/src/google/protobuf/stubs/strutil.cc
+++ b/src/google/protobuf/stubs/strutil.cc
@@ -58,17 +58,22 @@ inline bool IsNaN(double value) {
   return value != value;
 }
 
+// These are defined as macros on some platforms.  #undef them so that we can
+// redefine them.
+#undef isxdigit
+#undef isprint
+
 // The definitions of these in ctype.h change based on locale.  Since our
 // string manipulation is all in relation to the protocol buffer and C++
 // languages, we always want to use the C locale.  So, we re-define these
 // exactly as we want them.
-static bool isxdigit(char c) {
+inline bool isxdigit(char c) {
   return ('0' <= c && c <= '9') ||
          ('a' <= c && c <= 'f') ||
          ('A' <= c && c <= 'F');
 }
 
-static bool isprint(char c) {
+inline bool isprint(char c) {
   return c >= 0x20 && c <= 0x7E;
 }
 
diff --git a/src/google/protobuf/stubs/strutil.h b/src/google/protobuf/stubs/strutil.h
index 984c17e82cc2db3476327dde72368559ef067313..7f6bd96fe05c59c8fb37981219768f63a405df48 100644
--- a/src/google/protobuf/stubs/strutil.h
+++ b/src/google/protobuf/stubs/strutil.h
@@ -42,6 +42,10 @@ namespace protobuf {
 #ifdef _MSC_VER
 #define strtoll  _strtoi64
 #define strtoull _strtoui64
+#elif defined(__DECCXX) && defined(__osf__)
+// HP C++ on Tru64 does not have strtoll, but strtol is already 64-bit.
+#define strtoll strtol
+#define strtoull strtoul
 #endif
 
 // ----------------------------------------------------------------------
diff --git a/src/google/protobuf/text_format_unittest.cc b/src/google/protobuf/text_format_unittest.cc
index 97a4fb03223761249eb64e41cef5f7caa046b619..7610c3849748915e8be9e8fa80f7c17bbc8d09d8 100644
--- a/src/google/protobuf/text_format_unittest.cc
+++ b/src/google/protobuf/text_format_unittest.cc
@@ -52,7 +52,9 @@
 
 namespace google {
 namespace protobuf {
-namespace {
+
+// Can't use an anonymous namespace here due to brokenness of Tru64 compiler.
+namespace text_format_unittest {
 
 inline bool IsNaN(double value) {
   // NaN is never equal to anything, even itself.
@@ -778,7 +780,7 @@ TEST_F(TextFormatMessageSetTest, Deserialize) {
   EXPECT_EQ(2, descriptors.size());
 }
 
-} // namespace
+}  // namespace text_format_unittest
 }  // namespace protobuf
 
 }  // namespace google
diff --git a/src/gtest/gtest.cc b/src/gtest/gtest.cc
index 1eee39225a49fd1a94dc9a5b19e84bed4ed34154..09a0815a300fdc792bec3c668fdeff69868017c9 100644
--- a/src/gtest/gtest.cc
+++ b/src/gtest/gtest.cc
@@ -112,6 +112,21 @@
 
 namespace testing {
 
+// Calling ForEach(internal::Delete<T>) doesn't work on HP C++ / Tru64.  So,
+// we must define a separate non-template function for each type.
+static void DeleteTestCase(TestCase *x)
+{
+ delete x;
+}
+static void DeleteEnvironment(Environment *x)
+{
+ delete x;
+}
+static void DeleteTestInfo(TestInfo *x)
+{
+ delete x;
+}
+
 // Constants.
 
 // A test that matches this pattern is disabled and not run.
@@ -799,28 +814,6 @@ String FormatForFailureMessage(char ch) {
                         ch_as_uint, ch_as_uint);
 }
 
-// For a wchar_t value, we print it as a C++ wchar_t literal and as an
-// unsigned integer (both in decimal and in hexidecimal).
-String FormatForFailureMessage(wchar_t wchar) {
-  // The C++ standard doesn't specify the exact size of the wchar_t
-  // type.  It just says that it shall have the same size as another
-  // integral type, called its underlying type.
-  //
-  // Therefore, in order to print a wchar_t value in the numeric form,
-  // we first convert it to the largest integral type (UInt64) and
-  // then print the converted value.
-  //
-  // We use streaming to print the value as "%llu" doesn't work
-  // correctly with MSVC 7.1.
-  const UInt64 wchar_as_uint64 = wchar;
-  Message msg;
-  // A String object cannot contain '\0', so we print "\\0" when wchar is
-  // L'\0'.
-  msg << "L'" << (wchar ? ToUtf8String(wchar).c_str() : "\\0") << "' ("
-      << wchar_as_uint64 << ", 0x" << ::std::setbase(16)
-      << wchar_as_uint64 << ")";
-  return msg.GetString();
-}
 
 }  // namespace internal
 
@@ -2059,7 +2052,7 @@ TestCase::TestCase(const char* name,
 // Destructor of TestCase.
 TestCase::~TestCase() {
   // Deletes every Test in the collection.
-  test_info_list_->ForEach(internal::Delete<TestInfo>);
+  test_info_list_->ForEach(DeleteTestInfo);
 
   // Then deletes the Test collection.
   delete test_info_list_;
@@ -3039,10 +3032,10 @@ UnitTestImpl::UnitTestImpl(UnitTest* parent)
 
 UnitTestImpl::~UnitTestImpl() {
   // Deletes every TestCase.
-  test_cases_.ForEach(internal::Delete<TestCase>);
+  test_cases_.ForEach(DeleteTestCase);
 
   // Deletes every Environment.
-  environments_.ForEach(internal::Delete<Environment>);
+  environments_.ForEach(DeleteEnvironment);
 
   // Deletes the current test result printer.
   delete result_printer_;
diff --git a/src/gtest/internal/gtest-internal.h b/src/gtest/internal/gtest-internal.h
index 2be1b4acbc766acc066253ba7d46466f776d0cfb..883981f62c5220834862cb0e4f11f3f906b8acee 100644
--- a/src/gtest/internal/gtest-internal.h
+++ b/src/gtest/internal/gtest-internal.h
@@ -210,12 +210,13 @@ String StreamableToString(const T& streamable);
 
 // Formats a value to be used in a failure message.
 
-#ifdef __SYMBIAN32__
+#if defined (__SYMBIAN32__) || (defined (__DECCXX) && defined(__osf__))
 
-// These are needed as the Nokia Symbian Compiler cannot decide between
-// const T& and const T* in a function template. The Nokia compiler _can_
-// decide between class template specializations for T and T*, so a
-// tr1::type_traits-like is_pointer works, and we can overload on that.
+// These are needed as the Nokia Symbian Compiler and HP C++ on Tru64
+// cannot decide between const T& and const T* in a function template.
+// These compliers _can_ decide between class template specializations
+// for T and T*, so a tr1::type_traits-like is_pointer works, and we
+// can overload on that.
 
 // This overload makes sure that all pointers (including
 // those to char or wchar_t) are printed as raw pointers.
@@ -255,7 +256,6 @@ inline String FormatForFailureMessage(T* pointer) {
 
 // These overloaded versions handle narrow and wide characters.
 String FormatForFailureMessage(char ch);
-String FormatForFailureMessage(wchar_t wchar);
 
 // When this operand is a const char* or char*, and the other operand
 // is a ::std::string or ::string, we print this operand as a C string
diff --git a/src/gtest/internal/gtest-port.h b/src/gtest/internal/gtest-port.h
index 36d5a149c5129fcd02280ea5bbac12d81f5edce8..9d65ec83e84f00f9c47cec4f2456cec9a5786557 100644
--- a/src/gtest/internal/gtest-port.h
+++ b/src/gtest/internal/gtest-port.h
@@ -223,10 +223,10 @@
 //   struct Foo {
 //     Foo() { ... }
 //   } GTEST_ATTRIBUTE_UNUSED;
-#if defined(GTEST_OS_WINDOWS) || (defined(GTEST_OS_LINUX) && defined(SWIG))
-#define GTEST_ATTRIBUTE_UNUSED
-#else
+#ifdef __GNUC__
 #define GTEST_ATTRIBUTE_UNUSED __attribute__ ((unused))
+#else
+#define GTEST_ATTRIBUTE_UNUSED
 #endif  // GTEST_OS_WINDOWS || (GTEST_OS_LINUX && SWIG)
 
 // A macro to disallow the evil copy constructor and operator= functions