diff --git a/lib/Rewrite/Frontend/RewriteModernObjC.cpp b/lib/Rewrite/Frontend/RewriteModernObjC.cpp
index 0e59b11..6be20c4 100644
--- a/lib/Rewrite/Frontend/RewriteModernObjC.cpp
+++ b/lib/Rewrite/Frontend/RewriteModernObjC.cpp
@@ -6172,7 +6172,7 @@ void RewriteModernObjC::Initialize(ASTContext &context) {
   Preamble += "void **itemsPtr;\n\t";
   Preamble += "unsigned long *mutationsPtr;\n\t";
   Preamble += "unsigned long extra[5];\n};\n";
-  Preamble += "__OBJC_RW_DLLIMPORT void objc_enumerationMutation(struct objc_object *);\n";
+  Preamble += "__OBJC_RW_DLLIMPORT void objc_enumerationMutation(void *);\n";
   Preamble += "#define __FASTENUMERATIONSTATE\n";
   Preamble += "#endif\n";
   Preamble += "#ifndef __NSCONSTANTSTRINGIMPL\n";
diff --git a/lib/Rewrite/Frontend/RewriteObjC.cpp b/lib/Rewrite/Frontend/RewriteObjC.cpp
index 2f5cd0f..1a3e13b 100644
--- a/lib/Rewrite/Frontend/RewriteObjC.cpp
+++ b/lib/Rewrite/Frontend/RewriteObjC.cpp
@@ -5107,7 +5107,7 @@ void RewriteObjCFragileABI::Initialize(ASTContext &context) {
   Preamble += "void **itemsPtr;\n\t";
   Preamble += "unsigned long *mutationsPtr;\n\t";
   Preamble += "unsigned long extra[5];\n};\n";
-  Preamble += "__OBJC_RW_DLLIMPORT void objc_enumerationMutation(struct objc_object *);\n";
+  Preamble += "__OBJC_RW_DLLIMPORT void objc_enumerationMutation(void *);\n";
   Preamble += "#define __FASTENUMERATIONSTATE\n";
   Preamble += "#endif\n";
   Preamble += "#ifndef __NSCONSTANTSTRINGIMPL\n";
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index 034790d..eb5fcde 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -1008,6 +1008,17 @@ static bool shouldTryToOverload(Sema &S, FunctionDecl *New, FunctionDecl *Old,
       isa<FunctionNoProtoType>(NewQType.getTypePtr()))
     return false;
 
+  // [dcl.link] p6
+  // An entity with C language linkage shall not be declared with
+  // the same name as an entity in global scope, unless both declarations denote
+  // the same entity
+  if (S.getLangOpts().CPlusPlus) {
+    if ((Old->isExternC() && New->getDeclContext()->isTranslationUnit()) ||
+        (Old->getDeclContext()->isTranslationUnit() &&
+         New->isInExternCContext()))
+      return false;
+  }
+
   const FunctionProtoType* OldType = cast<FunctionProtoType>(OldQType);
   const FunctionProtoType* NewType = cast<FunctionProtoType>(NewQType);
 
diff --git a/test/SemaCXX/linkage-spec.cpp b/test/SemaCXX/linkage-spec.cpp
index fc14081..01a03ae 100644
--- a/test/SemaCXX/linkage-spec.cpp
+++ b/test/SemaCXX/linkage-spec.cpp
@@ -41,15 +41,14 @@ namespace pr5430 {
 using namespace pr5430;
 extern "C" void pr5430::func(void) { }
 
-// PR5404
-int f2(char *)
+int f2(char *) // expected-note {{previous definition is here}}
 {
         return 0;
 }
 
 extern "C"
 {
-    int f2(int)
+    int f2(int) // expected-error {{declaration of 'f2' has a different language linkage}}
     {
         return f2((char *)0);
     }
diff --git a/test/SemaCXX/linkage2.cpp b/test/SemaCXX/linkage2.cpp
index a811575..f6b0eb8 100644
--- a/test/SemaCXX/linkage2.cpp
+++ b/test/SemaCXX/linkage2.cpp
@@ -201,3 +201,8 @@ namespace test18 {
   }
   void *h() { return f(); }
 }
+
+extern "C" void pr16247_foo(int); // expected-note {{previous declaration is here}}
+static void pr16247_foo(double); // expected-error {{static declaration of 'pr16247_foo' follows non-static declaration}}
+void pr16247_foo(int) { } // expected-note {{previous definition is here}}
+void pr16247_foo(double) {} // expected-error {{conflicting types for 'pr16247_foo'}}
