[clang] [clang-repl] Re-emit implicitly instantiated templates on subsequent uses (PR #192588)

Tycho Lin via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 21 05:52:01 PDT 2026


================
@@ -0,0 +1,12 @@
+// REQUIRES: host-supports-jit
+// RUN: clang-repl -Xcc -fno-color-diagnostics < %s 2>&1 | FileCheck %s
+
+#include <cmath>
+extern "C" int printf(const char *, ...);
+
+(10-)*std::pow(2,2);
----------------
voyager-jhk wrote:

Yes, a standalone std::pow(2,2) works perfectly. The bug requires an implicit instantiation inside a statement that fails to parse. CodeGen drops the failed module, but Sema caches the instantiated body. Subsequent valid calls then skip emission, starving the JIT.

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


More information about the cfe-commits mailing list