diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-12-18 22:19:11 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-12-18 22:19:11 +0000 |
commit | 82b8d4e6fd79e8ff84d9c16a10822ec0c08c835b (patch) | |
tree | 645c2f7cddcc6634a63f9121fead342c8f609711 /clang/lib/Sema/SemaOverload.cpp | |
parent | e78b3e6fcf1240abd945b25dee0c1f4dc73e1b17 (diff) | |
download | bcm5719-llvm-82b8d4e6fd79e8ff84d9c16a10822ec0c08c835b.tar.gz bcm5719-llvm-82b8d4e6fd79e8ff84d9c16a10822ec0c08c835b.zip |
[modules] Don't try to use the definition of a class if
RequireCompleteType(..., 0) says we're not permitted to do so. The definition
might not be visible, even though we know what it is.
llvm-svn: 256045
Diffstat (limited to 'clang/lib/Sema/SemaOverload.cpp')
-rw-r--r-- | clang/lib/Sema/SemaOverload.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index a0fb1ea3db5..58949bfd440 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -3085,11 +3085,7 @@ IsUserDefinedConversion(Sema &S, Expr *From, QualType ToType, S.IsDerivedFrom(From->getLocStart(), From->getType(), ToType))) ConstructorsOnly = true; - S.RequireCompleteType(From->getExprLoc(), ToType, 0); - // RequireCompleteType may have returned true due to some invalid decl - // during template instantiation, but ToType may be complete enough now - // to try to recover. - if (ToType->isIncompleteType()) { + if (S.RequireCompleteType(From->getExprLoc(), ToType, 0)) { // We're not going to find any constructors. } else if (CXXRecordDecl *ToRecordDecl = dyn_cast<CXXRecordDecl>(ToRecordType->getDecl())) { @@ -6685,7 +6681,8 @@ void Sema::AddMemberOperatorCandidates(OverloadedOperatorKind Op, // the set of member candidates is empty. if (const RecordType *T1Rec = T1->getAs<RecordType>()) { // Complete the type if it can be completed. - RequireCompleteType(OpLoc, T1, 0); + if (RequireCompleteType(OpLoc, T1, 0) && !T1Rec->isBeingDefined()) + return; // If the type is neither complete nor being defined, bail out now. if (!T1Rec->getDecl()->getDefinition()) return; |