[clang] [clang] Fix crash on invalid `std::initializer_list<T>` template-id (PR #132284)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 20 20:48:47 PDT 2025
================
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 %s -verify -std=c++20
+
+namespace std {
+
+template<class T, class = T::x> // expected-error 2 {{type 'int' cannot be used prior to '::' because it has no members}}
+class initializer_list;
+
+}
+
+auto x = {1}; // expected-note {{in instantiation of default argument for 'initializer_list<int>' required here}}
+
+void f() {
+ for(int x : {1, 2}); // expected-note {{in instantiation of default argument for 'initializer_list<int>' required here}}
+}
----------------
zyn0217 wrote:
We usually wrap the test with a namespace of its corresponding GH number.
https://github.com/llvm/llvm-project/pull/132284
More information about the cfe-commits
mailing list