diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 2fd9fc4..436b4b6 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -3240,9 +3240,11 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
     // top-level template type arguments.
     bool FreeFunction;
     if (!D.getCXXScopeSpec().isSet()) {
-      FreeFunction = ((D.getContext() != Declarator::MemberContext &&
-                       D.getContext() != Declarator::LambdaExprContext) ||
-                      D.getDeclSpec().isFriendSpecified());
+      const DeclSpec &Spec = D.getDeclSpec();
+      FreeFunction = (D.getContext() != Declarator::MemberContext &&
+                      D.getContext() != Declarator::LambdaExprContext) ||
+                     Spec.isFriendSpecified() ||
+                     Spec.getStorageClassSpec() == DeclSpec::SCS_typedef;
     } else {
       DeclContext *DC = S.computeDeclContext(D.getCXXScopeSpec());
       FreeFunction = (DC && !DC->isRecord());
diff --git a/test/SemaCXX/decl-microsoft-call-conv.cpp b/test/SemaCXX/decl-microsoft-call-conv.cpp
index 9d42add..e47a5c2 100644
--- a/test/SemaCXX/decl-microsoft-call-conv.cpp
+++ b/test/SemaCXX/decl-microsoft-call-conv.cpp
@@ -167,3 +167,12 @@ namespace test2 {
   };
   extern template void foo::bar(const void *);
 }
+
+namespace test3 {
+  struct foo {
+    typedef void bar();
+  };
+  bool zed(foo::bar *);
+  void bah() {}
+  void baz() { zed(bah); }
+}
