summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorAnastasia Stulova <anastasia.stulova@arm.com>2017-05-08 16:05:54 +0000
committerAnastasia Stulova <anastasia.stulova@arm.com>2017-05-08 16:05:54 +0000
commitf16634c884b6e3aa1a573d0a1f4727103ca8ccf8 (patch)
treea4b1859e22b8134d9576ce5a3f8b52d12963854f /clang
parent0fbdaa1f0c136ce8921beca6a9dee72c70134b1c (diff)
downloadbcm5719-llvm-f16634c884b6e3aa1a573d0a1f4727103ca8ccf8.tar.gz
bcm5719-llvm-f16634c884b6e3aa1a573d0a1f4727103ca8ccf8.zip
[Sema] Fix typos handling in an overloadable call.
In C typos in arguments in a call of an overloadable function lead to a failure of construction of CallExpr and following recovery does not handle created delayed typos. This causes an assertion fail in Sema::~Sema since Sema::DelayedTypos remains not empty. The patch fixes that behavior by handling a call with arguments having dependant types in the way that C++ does. Differential Revision: https://reviews.llvm.org/D31764 Patch by Dmitry Borisenkov! llvm-svn: 302435
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp3
-rw-r--r--clang/test/Sema/typo-correction.c7
2 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 849e978e2d8..c32c91e7064 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -5277,6 +5277,9 @@ ExprResult Sema::ActOnCallExpr(Scope *Scope, Expr *Fn, SourceLocation LParenLoc,
// We aren't supposed to apply this logic if there's an '&' involved.
if (!find.HasFormOfMemberPointer) {
+ if (Expr::hasAnyTypeDependentArguments(ArgExprs))
+ return new (Context) CallExpr(
+ Context, Fn, ArgExprs, Context.DependentTy, VK_RValue, RParenLoc);
OverloadExpr *ovl = find.Expression;
if (UnresolvedLookupExpr *ULE = dyn_cast<UnresolvedLookupExpr>(ovl))
return BuildOverloadedCallExpr(
diff --git a/clang/test/Sema/typo-correction.c b/clang/test/Sema/typo-correction.c
index 59f022dfe52..78007015dca 100644
--- a/clang/test/Sema/typo-correction.c
+++ b/clang/test/Sema/typo-correction.c
@@ -80,3 +80,10 @@ int h() {
g(x, 5 ? z : 0); // expected-error 2 {{use of undeclared identifier}}
(x, 5 ? z : 0); // expected-error 2 {{use of undeclared identifier}}
}
+
+__attribute__((overloadable)) void func_overloadable(int);
+__attribute__((overloadable)) void func_overloadable(float);
+
+void overloadable_callexpr(int arg) {
+ func_overloadable(ar); //expected-error{{use of undeclared identifier}}
+}
OpenPOWER on IntegriCloud