summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/SemaExpr.cpp8
-rw-r--r--lib/Sema/SemaExprCXX.cpp4
-rw-r--r--test/SemaCXX/typo-correction-delayed.cpp8
3 files changed, 14 insertions, 6 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 93b4c30871..091fd27db8 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -4762,12 +4762,8 @@ Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl,
VK_RValue, RParenLoc);
// Bail out early if calling a builtin with custom typechecking.
- if (BuiltinID && Context.BuiltinInfo.hasCustomTypechecking(BuiltinID)) {
- ExprResult Res = CorrectDelayedTyposInExpr(TheCall);
- if (!Res.isUsable() || !isa<CallExpr>(Res.get()))
- return Res;
- return CheckBuiltinFunctionCall(FDecl, BuiltinID, cast<CallExpr>(Res.get()));
- }
+ if (BuiltinID && Context.BuiltinInfo.hasCustomTypechecking(BuiltinID))
+ return CheckBuiltinFunctionCall(FDecl, BuiltinID, TheCall);
retry:
const FunctionType *FuncT;
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index ca15550768..3e2a2de5b4 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -6232,8 +6232,12 @@ ExprResult Sema::CorrectDelayedTyposInExpr(
if (E && !ExprEvalContexts.empty() && ExprEvalContexts.back().NumTypos &&
(E->isTypeDependent() || E->isValueDependent() ||
E->isInstantiationDependent())) {
+ auto TyposInContext = ExprEvalContexts.back().NumTypos;
+ assert(TyposInContext < ~0U && "Recursive call of CorrectDelayedTyposInExpr");
+ ExprEvalContexts.back().NumTypos = ~0U;
auto TyposResolved = DelayedTypos.size();
auto Result = TransformTypos(*this, Filter).Transform(E);
+ ExprEvalContexts.back().NumTypos = TyposInContext;
TyposResolved -= DelayedTypos.size();
if (Result.isInvalid() || Result.get() != E) {
ExprEvalContexts.back().NumTypos -= TyposResolved;
diff --git a/test/SemaCXX/typo-correction-delayed.cpp b/test/SemaCXX/typo-correction-delayed.cpp
index a73a5dc809..79ab3f5979 100644
--- a/test/SemaCXX/typo-correction-delayed.cpp
+++ b/test/SemaCXX/typo-correction-delayed.cpp
@@ -166,6 +166,14 @@ namespace PR22250 {
int getenv_s(size_t *y, char(&z)) {}
}
+namespace PR22291 {
+template <unsigned I> void f() {
+ unsigned *prio_bits_array; // expected-note {{'prio_bits_array' declared here}}
+ // expected-error@+1 {{use of undeclared identifier 'prio_op_array'; did you mean 'prio_bits_array'?}}
+ __atomic_store_n(prio_op_array + I, false, __ATOMIC_RELAXED);
+}
+}
+
namespace PR22297 {
double pow(double x, double y);
struct TimeTicks {