diff options
author | Douglas Gregor <dgregor@apple.com> | 2008-12-19 17:40:08 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2008-12-19 17:40:08 +0000 |
commit | 47d3f2742a3b69e1231aa09d0daf9eed3d8163c9 (patch) | |
tree | ad803fe30ac0aeb021276735427d90071c1fcda5 /clang/lib/Sema/SemaDecl.cpp | |
parent | 324de7ba46c961e5cce879f30f9be57a040c6a3e (diff) | |
download | bcm5719-llvm-47d3f2742a3b69e1231aa09d0daf9eed3d8163c9.tar.gz bcm5719-llvm-47d3f2742a3b69e1231aa09d0daf9eed3d8163c9.zip |
Allow downcasts of pointers to Objective-C interfaces, with a
warning. This matches GCC's behavior and addresses
<rdar://problem/6458293>.
llvm-svn: 61246
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 925a7bb29b5..6c1af5f8787 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -744,7 +744,10 @@ bool Sema::CheckSingleInitializer(Expr *&Init, QualType DeclType) { // Get the type before calling CheckSingleAssignmentConstraints(), since // it can promote the expression. QualType InitType = Init->getType(); - + + if (getLangOptions().CPlusPlus) + return PerformCopyInitialization(Init, DeclType, "initializing"); + AssignConvertType ConvTy = CheckSingleAssignmentConstraints(DeclType, Init); return DiagnoseAssignmentResult(ConvTy, Init->getLocStart(), DeclType, InitType, Init, "initializing"); @@ -843,7 +846,7 @@ bool Sema::CheckInitializerTypes(Expr *&Init, QualType &DeclType, // destination type. // FIXME: We're pretending to do copy elision here; return to // this when we have ASTs for such things. - if (!PerformImplicitConversion(Init, DeclType)) + if (!PerformImplicitConversion(Init, DeclType, "initializing")) return false; return Diag(InitLoc, diag::err_typecheck_convert_incompatible) |