diff options
author | John McCall <rjmccall@apple.com> | 2010-10-08 02:01:28 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-10-08 02:01:28 +0000 |
commit | b4eb64d8426c0eaa58d398961e0e74ff85063d7c (patch) | |
tree | 92661fe6b3f4a26a332faf5be9a3d4c251b107ec /lib/Sema/SemaDeclCXX.cpp | |
parent | 9a2b9d794bdf349b517ff799170f4409f45d147c (diff) |
Track the location of the context requiring an implicit conversion and use it
to white-list conversions required by system headers. rdar://problem/8232669
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116029 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 181b7169c5..a27785e4f3 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -136,6 +136,7 @@ Sema::SetParamDefaultArgument(ParmVarDecl *Param, Expr *Arg, return true; Arg = Result.takeAs<Expr>(); + CheckImplicitConversions(Arg, EqualLoc); Arg = MaybeCreateCXXExprWithTemporaries(Arg); // Okay: add the default argument to the parameter @@ -1276,6 +1277,8 @@ Sema::BuildMemberInitializer(FieldDecl *Member, Expr **Args, MultiExprArg(*this, Args, NumArgs), 0); if (MemberInit.isInvalid()) return true; + + CheckImplicitConversions(MemberInit.get(), LParenLoc); // C++0x [class.base.init]p7: // The initialization of each base and member constitutes a @@ -1407,6 +1410,8 @@ Sema::BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo, MultiExprArg(*this, Args, NumArgs), 0); if (BaseInit.isInvalid()) return true; + + CheckImplicitConversions(BaseInit.get(), LParenLoc); // C++0x [class.base.init]p7: // The initialization of each base and member constitutes a @@ -5356,6 +5361,7 @@ bool Sema::InitializeVarWithConstructor(VarDecl *VD, return true; Expr *Temp = TempResult.takeAs<Expr>(); + CheckImplicitConversions(Temp, VD->getLocation()); MarkDeclarationReferenced(VD->getLocation(), Constructor); Temp = MaybeCreateCXXExprWithTemporaries(Temp); VD->setInit(Temp); @@ -5489,6 +5495,8 @@ void Sema::AddCXXDirectInitializerToDecl(Decl *RealDecl, VDecl->setInvalidDecl(); return; } + + CheckImplicitConversions(Result.get(), LParenLoc); Result = MaybeCreateCXXExprWithTemporaries(Result.get()); VDecl->setInit(Result.takeAs<Expr>()); @@ -6834,7 +6842,7 @@ void Sema::SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation) { // is required (e.g., because it would call a trivial default constructor) if (!MemberInit.get() || MemberInit.isInvalid()) continue; - + Member = new (Context) CXXBaseOrMemberInitializer(Context, Field, SourceLocation(), |