diff options
author | John McCall <rjmccall@apple.com> | 2009-09-30 01:30:54 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2009-09-30 01:30:54 +0000 |
commit | 432887fadd6bf87a6985906d6cef356b1f617d84 (patch) | |
tree | 24633fdc4ba745980eadf7c786a17b9ea227ac67 /lib/Sema/SemaExprCXX.cpp | |
parent | c4e8321deb2bd83f734a09749460050f40ec51d1 (diff) |
Spare the processors of those poor wretches who have no choice but to write
unbounded chains of operator-> delegations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83134 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExprCXX.cpp')
-rw-r--r-- | lib/Sema/SemaExprCXX.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 25a6591d76..dafafba474 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -1978,8 +1978,8 @@ Sema::ActOnStartCXXMemberReference(Scope *S, ExprArg Base, SourceLocation OpLoc, // returned, with the original second operand. if (OpKind == tok::arrow) { // The set of types we've considered so far. - llvm::SmallVector<CanQualType,8> CTypes; - CTypes.push_back(Context.getCanonicalType(BaseType)); + llvm::SmallPtrSet<CanQualType,8> CTypes; + CTypes.insert(Context.getCanonicalType(BaseType)); while (BaseType->isRecordType()) { Base = BuildOverloadedArrowExpr(S, move(Base), BaseExpr->getExprLoc()); @@ -1988,12 +1988,11 @@ Sema::ActOnStartCXXMemberReference(Scope *S, ExprArg Base, SourceLocation OpLoc, return ExprError(); BaseType = BaseExpr->getType(); CanQualType CBaseType = Context.getCanonicalType(BaseType); - if (std::find(CTypes.begin(), CTypes.end(), CBaseType) != CTypes.end()) { + if (!CTypes.insert(CBaseType)) { // TODO: note the chain of conversions Diag(OpLoc, diag::err_operator_arrow_circular); return ExprError(); } - CTypes.push_back(CBaseType); } } |