summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2008-12-19 17:40:08 +0000
committerDouglas Gregor <dgregor@apple.com>2008-12-19 17:40:08 +0000
commit47d3f2742a3b69e1231aa09d0daf9eed3d8163c9 (patch)
treead803fe30ac0aeb021276735427d90071c1fcda5 /clang/lib/Sema/SemaDecl.cpp
parent324de7ba46c961e5cce879f30f9be57a040c6a3e (diff)
downloadbcm5719-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.cpp7
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)
OpenPOWER on IntegriCloud