Index: lib/CodeGen/CodeGenTypes.h
===================================================================
--- lib/CodeGen/CodeGenTypes.h  (revision 167645)
+++ lib/CodeGen/CodeGenTypes.h  (working copy)
@@ -92,7 +92,7 @@
   llvm::SmallPtrSet<const Type*, 4> RecordsBeingLaidOut;
   
   llvm::SmallPtrSet<const CGFunctionInfo*, 4> FunctionsBeingProcessed;
-  
+
   /// SkippedLayout - True if we didn't layout a function due to a being inside
   /// a recursive struct conversion, set this to true.
   bool SkippedLayout;
@@ -251,6 +251,9 @@
   bool isRecordBeingLaidOut(const Type *Ty) const {
     return RecordsBeingLaidOut.count(Ty);
   }   
+  bool noFunctionsBeingProcessed() const {
+    return FunctionsBeingProcessed.empty();
+  }
    
 };
 
Index: lib/CodeGen/CodeGenTypes.cpp
===================================================================
--- lib/CodeGen/CodeGenTypes.cpp  (revision 167645)
+++ lib/CodeGen/CodeGenTypes.cpp  (working copy)
@@ -178,6 +178,9 @@
 /// decl to IR and lay it out, false if doing so would cause us to get into a
 /// recursive compilation mess.
 static bool isSafeToConvert(const RecordDecl *RD, CodeGenTypes &CGT) {
+  // If functions are being processed, this struct is deferred.
+  if (!CGT.noFunctionsBeingProcessed()) return false;
+
   // If no structs are being laid out, we can certainly do this one.
   if (CGT.noRecordsBeingLaidOut()) return true;
   
@@ -448,17 +451,6 @@
   case Type::FunctionNoProto:
   case Type::FunctionProto: {
     const FunctionType *FT = cast<FunctionType>(Ty);
-    // First, check whether we can build the full function type.  If the
-    // function type depends on an incomplete type (e.g. a struct or enum), we
-    // cannot lower the function type.
-    if (!isFuncTypeConvertible(FT)) {
-      // This function's type depends on an incomplete tag type.
-      // Return a placeholder type.
-      ResultType = llvm::StructType::get(getLLVMContext());
-      
-      SkippedLayout = true;
-      break;
-    }

     // While we're converting the argument types for a function, we don't want
     // to recursively convert any pointed-to structs.  Converting directly-used