[PATCH] D136962: [clang] Improve error recovery for pack expansion of expressions
Matheus Izvekov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 28 09:25:29 PDT 2022
mizvekov created this revision.
Herald added a project: All.
mizvekov requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Closes #58673.
Signed-off-by: Matheus Izvekov <mizvekov at gmail.com>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D136962
Files:
clang/docs/ReleaseNotes.rst
clang/lib/AST/ComputeDependence.cpp
clang/test/CXX/temp/temp.decls/temp.variadic/p5.cpp
Index: clang/test/CXX/temp/temp.decls/temp.variadic/p5.cpp
===================================================================
--- clang/test/CXX/temp/temp.decls/temp.variadic/p5.cpp
+++ clang/test/CXX/temp/temp.decls/temp.variadic/p5.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++11 -fblocks -fms-extensions -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++11 -fblocks -fms-extensions -fsyntax-only -verify=expected,cxx11 %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++2b -fblocks -fms-extensions -fsyntax-only -verify=expected %s
template<typename T, typename U> struct pair;
template<typename ...> struct tuple;
@@ -164,7 +165,9 @@
// FIXME: this should test that the diagnostic reads "type contains..."
struct alignas(Types) TestUnexpandedDecls : T{ // expected-error{{expression contains unexpanded parameter pack 'Types'}}
void member_function(Types); // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
+#if __cplusplus < 201703L
void member_function () throw(Types); // expected-error{{exception type contains unexpanded parameter pack 'Types'}}
+#endif
void member_function2() noexcept(Types()); // expected-error{{expression contains unexpanded parameter pack 'Types'}}
operator Types() const; // expected-error{{declaration type contains unexpanded parameter pack 'Types'}}
Types data_member; // expected-error{{data member type contains unexpanded parameter pack 'Types'}}
@@ -427,7 +430,7 @@
namespace PR21289 {
template<int> using T = int;
template<typename> struct S { static const int value = 0; };
- template<typename> const int vt = 0; // expected-warning {{extension}}
+ template<typename> const int vt = 0; // cxx11-warning {{extension}}
int f(...);
template<int ...Ns> void g() {
f(T<Ns>()...);
@@ -491,3 +494,11 @@
using t2 = E<true>::B<false>;
// expected-note at -1 {{in instantiation of template class 'pr56094::E<true>' requested here}}
} // namespace pr56094
+
+namespace GH56094 {
+#if __cplusplus >= 201402L
+template <class> struct A; // expected-note {{template is declared here}}
+template <class> using B = char;
+template <class ...Cs> int C{ A<B<Cs>>{}... }; // expected-error {{implicit instantiation of undefined template}}
+#endif
+}; // namespace GH56094
Index: clang/lib/AST/ComputeDependence.cpp
===================================================================
--- clang/lib/AST/ComputeDependence.cpp
+++ clang/lib/AST/ComputeDependence.cpp
@@ -573,7 +573,7 @@
// - type-dependent if we don't know the type (fallback to an opaque
// dependent type), or the type is known and dependent, or it has
// type-dependent subexpressions.
- auto D = toExprDependenceForImpliedType(E->getType()->getDependence()) |
+ auto D = toExprDependenceAsWritten(E->getType()->getDependence()) |
ExprDependence::ErrorDependent;
// FIXME: remove the type-dependent bit from subexpressions, if the
// RecoveryExpr has a non-dependent type.
Index: clang/docs/ReleaseNotes.rst
===================================================================
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -336,6 +336,8 @@
<https://clang.llvm.org/docs/ControlFlowIntegrity.html>`_ failures. This diagnostic
is grouped under ``-Wcast-function-type`` as it identifies a more strict set of
potentially problematic function type casts.
+- Better error recovery for pack expansion of expressions.
+ `Issue 58673 <https://github.com/llvm/llvm-project/issues/58673>`_.
Non-comprehensive list of changes in this release
-------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136962.471578.patch
Type: text/x-patch
Size: 3692 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221028/350b7ec8/attachment.bin>
More information about the cfe-commits
mailing list