[clang] [Clang] Fix a crash when dumping a pack indexing type. (PR #80439)

Björn Pettersson via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 4 14:58:46 PST 2024


================
@@ -0,0 +1,25 @@
+// RUN: not %clang_cc1 -std=c++2c -ast-dump %s | FileCheck  %s
+
+namespace InvalidPacksShouldNotCrash {
+
+struct NotAPack;
+template <typename T, auto V, template<typename> typename Tp>
+void not_pack() {
+    int i = 0;
+    i...[0]; // expected-error {{i does not refer to the name of a parameter pack}}
+    V...[0]; // expected-error {{V does not refer to the name of a parameter pack}}
+    NotAPack...[0] a; // expected-error{{'NotAPack' does not refer to the name of a parameter pack}}
----------------
bjope wrote:

If you change this to an array, such as

`NotAPack...[0] a[2];`

then I think you hit the same kind of infinite recursion as we see downstream even without the array nodtation.

https://github.com/llvm/llvm-project/pull/80439


More information about the cfe-commits mailing list