[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

llvm-svn: 366200

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

index 9b23624..d976265 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/clang/test/SemaTemplate/typo-variadic.cpp b/clang/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}}