diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2009-12-20 22:12:03 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2009-12-20 22:12:03 +0000 |
commit | 33c2da9b3abdade4f0df4f90962fb8c518967fc4 (patch) | |
tree | 7cd4604344b64f79681a721c76b4c15189ba9788 /lib/Sema/SemaInit.cpp | |
parent | 745880f35066bdb1950d0e870608295221346fc5 (diff) |
Fix review comment; no visible change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91797 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaInit.cpp')
-rw-r--r-- | lib/Sema/SemaInit.cpp | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index 18164d685f..466e6ccaf8 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -2727,37 +2727,38 @@ static void TryUserDefinedConversion(Sema &S, // 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); + // 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()); - if (AllowExplicit || !Conv->isExplicit()) { + 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); + } } } } |