]> granicus.if.org Git - clang/commitdiff
[SemaTemplate] Fix uncorrected typos after pack expansion
authorSam McCall <sam.mccall@gmail.com>
Tue, 16 Jul 2019 10:30:21 +0000 (10:30 +0000)
committerSam McCall <sam.mccall@gmail.com>
Tue, 16 Jul 2019 10:30:21 +0000 (10:30 +0000)
Summary:
This case is particularly important for clangd, as it is triggered after
inserting the snippet for variadic functions.

Reviewers: kadircet, ilya-biryukov

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D64677

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@366200 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaTemplateVariadic.cpp
test/SemaTemplate/typo-variadic.cpp [new file with mode: 0644]

index 9b23624a9a81f73bae7b212b00288c870638c919..d97626551a41f7a858a97a7807fc7592eeb93804 100644 (file)
@@ -619,6 +619,7 @@ ExprResult Sema::CheckPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc,
   if (!Pattern->containsUnexpandedParameterPack()) {
     Diag(EllipsisLoc, diag::err_pack_expansion_without_parameter_packs)
     << Pattern->getSourceRange();
+    CorrectDelayedTyposInExpr(Pattern);
     return ExprError();
   }
 
diff --git a/test/SemaTemplate/typo-variadic.cpp b/test/SemaTemplate/typo-variadic.cpp
new file mode 100644 (file)
index 0000000..c9b777a
--- /dev/null
@@ -0,0 +1,2 @@
+// RUN: %clang_cc1 -fsyntax-only %s -verify
+int x = m(s...); // expected-error{{pack expansion does not}} expected-error{{undeclared identifier}}