[cfe-commits] r91797 - /cfe/trunk/lib/Sema/SemaInit.cpp

Eli Friedman eli.friedman at gmail.com
Sun Dec 20 14:12:04 PST 2009


Author: efriedma
Date: Sun Dec 20 16:12:03 2009
New Revision: 91797

URL: http://llvm.org/viewvc/llvm-project?rev=91797&view=rev
Log:
Fix review comment; no visible change.


Modified:
    cfe/trunk/lib/Sema/SemaInit.cpp

Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=91797&r1=91796&r2=91797&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Sun Dec 20 16:12:03 2009
@@ -2727,37 +2727,38 @@
     // The type we're converting from is a class type, enumerate its conversion
     // functions.
 
-    // Try to force the type to be complete before enumerating the conversion
-    // functions; it's okay if this fails, though.
-    S.RequireCompleteType(DeclLoc, SourceType, 0);
-
-    CXXRecordDecl *SourceRecordDecl
-      = cast<CXXRecordDecl>(SourceRecordType->getDecl());
-    
-    const UnresolvedSet *Conversions
-      = SourceRecordDecl->getVisibleConversionFunctions();
-    for (UnresolvedSet::iterator I = Conversions->begin(),
-         E = Conversions->end(); 
-         I != E; ++I) {
-      NamedDecl *D = *I;
-      CXXRecordDecl *ActingDC = cast<CXXRecordDecl>(D->getDeclContext());
-      if (isa<UsingShadowDecl>(D))
-        D = cast<UsingShadowDecl>(D)->getTargetDecl();
-      
-      FunctionTemplateDecl *ConvTemplate = dyn_cast<FunctionTemplateDecl>(D);
-      CXXConversionDecl *Conv;
-      if (ConvTemplate)
-        Conv = cast<CXXConversionDecl>(ConvTemplate->getTemplatedDecl());
-      else
-        Conv = cast<CXXConversionDecl>(*I);
-      
-      if (AllowExplicit || !Conv->isExplicit()) {
+    // We can only enumerate the conversion functions for a complete type; if
+    // the type isn't complete, simply skip this step.
+    if (!S.RequireCompleteType(DeclLoc, SourceType, 0)) {
+      CXXRecordDecl *SourceRecordDecl
+        = cast<CXXRecordDecl>(SourceRecordType->getDecl());
+      
+      const UnresolvedSet *Conversions
+        = SourceRecordDecl->getVisibleConversionFunctions();
+      for (UnresolvedSet::iterator I = Conversions->begin(),
+           E = Conversions->end(); 
+           I != E; ++I) {
+        NamedDecl *D = *I;
+        CXXRecordDecl *ActingDC = cast<CXXRecordDecl>(D->getDeclContext());
+        if (isa<UsingShadowDecl>(D))
+          D = cast<UsingShadowDecl>(D)->getTargetDecl();
+        
+        FunctionTemplateDecl *ConvTemplate = dyn_cast<FunctionTemplateDecl>(D);
+        CXXConversionDecl *Conv;
         if (ConvTemplate)
-          S.AddTemplateConversionCandidate(ConvTemplate, ActingDC, Initializer,
-                                           DestType, CandidateSet);
+          Conv = cast<CXXConversionDecl>(ConvTemplate->getTemplatedDecl());
         else
-          S.AddConversionCandidate(Conv, ActingDC, Initializer, DestType,
-                                   CandidateSet);
+          Conv = cast<CXXConversionDecl>(*I);
+        
+        if (AllowExplicit || !Conv->isExplicit()) {
+          if (ConvTemplate)
+            S.AddTemplateConversionCandidate(ConvTemplate, ActingDC,
+                                             Initializer, DestType,
+                                             CandidateSet);
+          else
+            S.AddConversionCandidate(Conv, ActingDC, Initializer, DestType,
+                                     CandidateSet);
+        }
       }
     }
   }





More information about the cfe-commits mailing list