summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaCast.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2015-09-04 10:17:10 +0000
committerOlivier Goffart <ogoffart@woboq.com>2015-09-04 10:17:10 +0000
commit1ba7dc38d0a1fd742d9502b516b35b004e5bb33f (patch)
tree67c9875eb9bfd912b5c71277a3c484585edf2fdf /clang/lib/Sema/SemaCast.cpp
parenta04668ff341a11b4f6b31b186d0c647fc5c198ee (diff)
downloadbcm5719-llvm-1ba7dc38d0a1fd742d9502b516b35b004e5bb33f.tar.gz
bcm5719-llvm-1ba7dc38d0a1fd742d9502b516b35b004e5bb33f.zip
Fix the perentheses location when the constructor is called on a class that has a destructor
llvm-svn: 246844
Diffstat (limited to 'clang/lib/Sema/SemaCast.cpp')
-rw-r--r--clang/lib/Sema/SemaCast.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaCast.cpp b/clang/lib/Sema/SemaCast.cpp
index dea9c22b74b..446c68055a6 100644
--- a/clang/lib/Sema/SemaCast.cpp
+++ b/clang/lib/Sema/SemaCast.cpp
@@ -2483,8 +2483,11 @@ ExprResult Sema::BuildCXXFunctionalCastExpr(TypeSourceInfo *CastTypeInfo,
Op.CheckCXXCStyleCast(/*FunctionalStyle=*/true, /*ListInit=*/false);
if (Op.SrcExpr.isInvalid())
return ExprError();
-
- if (CXXConstructExpr *ConstructExpr = dyn_cast<CXXConstructExpr>(Op.SrcExpr.get()))
+
+ auto *SubExpr = Op.SrcExpr.get();
+ if (auto *BindExpr = dyn_cast<CXXBindTemporaryExpr>(SubExpr))
+ SubExpr = BindExpr->getSubExpr();
+ if (auto *ConstructExpr = dyn_cast<CXXConstructExpr>(SubExpr))
ConstructExpr->setParenOrBraceRange(SourceRange(LPLoc, RPLoc));
return Op.complete(CXXFunctionalCastExpr::Create(Context, Op.ResultType,
OpenPOWER on IntegriCloud