[clang] [clang] Fix TemplateInstantiator crash transforming loop hint argument (PR #172289)

Bruno De Fraine via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 7 13:51:34 PST 2026


================
@@ -8,3 +8,28 @@ template <int Unroll> void foo() {
   #pragma GCC unroll Unroll
   for (int i = 0; i < Unroll; ++i);
 }
+
+struct val {
+  constexpr operator int() const { return 1; }
+};
+
+// generic lambda (using double template instantiation)
+
+template<typename T>
+void use(T t) {
+  auto lam = [](auto N) {
----------------
brunodf-snps wrote:

I've still added a code comment (see commit e7efc38d) to explain that the guard against a value dependent expression _after_ template instantiation is presently needed, but could in the future become unnecessary (i.e. your remark "ONE day we will fix that").

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


More information about the cfe-commits mailing list