diff --git a/include/flatbuffers/code_generators.h b/include/flatbuffers/code_generators.h
index a832334ecbdf7a419bcd16f18c2fbcc17995c0af..95fa0c1ac5a58d3284fc750446a06ec8fc4f5f20 100644
--- a/include/flatbuffers/code_generators.h
+++ b/include/flatbuffers/code_generators.h
@@ -45,6 +45,10 @@ class BaseGenerator {
         namespace_dir_(BaseGenerator::NamespaceDir(parser, path)){};
   virtual ~BaseGenerator(){};
 
+  // No copy/assign.
+  BaseGenerator &operator=(const BaseGenerator &);
+  BaseGenerator(const BaseGenerator &);
+
   const char *FlatBuffersGeneratedWarning() {
     return "automatically generated by the FlatBuffers compiler,"
            " do not modify\n\n";
diff --git a/src/idl_parser.cpp b/src/idl_parser.cpp
index 2bf99eac0cf2b2b81fba11a51aefbcb0e99004dc..f5badab16b90a0affb8a5e1aab13c0f40a8991a9 100644
--- a/src/idl_parser.cpp
+++ b/src/idl_parser.cpp
@@ -275,7 +275,7 @@ CheckedError Parser::Next() {
                     return Error(
                       "illegal Unicode sequence (multiple high surrogates)");
                   } else {
-                    unicode_high_surrogate = val;
+                    unicode_high_surrogate = static_cast<int>(val);
                   }
                 } else if (val >= 0xDC00 && val <= 0xDFFF) {
                   if (unicode_high_surrogate == -1) {
@@ -2001,14 +2001,14 @@ flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<
     Definition::SerializeAttributes(FlatBufferBuilder *builder,
                                     const Parser &parser) const {
   std::vector<flatbuffers::Offset<reflection::KeyValue>> attrs;
-  for (auto kv : attributes.dict) {
-    auto it = parser.known_attributes_.find(kv.first);
+  for (auto kv = attributes.dict.begin(); kv != attributes.dict.end(); ++kv) {
+    auto it = parser.known_attributes_.find(kv->first);
     assert(it != parser.known_attributes_.end());
     if (!it->second) {  // Custom attribute.
       attrs.push_back(
-          reflection::CreateKeyValue(*builder, builder->CreateString(kv.first),
+          reflection::CreateKeyValue(*builder, builder->CreateString(kv->first),
                                      builder->CreateString(
-                                         kv.second->constant)));
+                                         kv->second->constant)));
     }
   }
   if (attrs.size()) {