[clang] [llvm] [Clang] Fix cleanup attribute by delaying type checks after the type is deduced (PR #164440)

Guillot Tony via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 17 13:49:00 PST 2025


================
@@ -8311,3 +8301,28 @@ void Sema::redelayDiagnostics(DelayedDiagnosticPool &pool) {
   assert(curPool && "re-emitting in undelayed context not supported");
   curPool->steal(pool);
 }
+
+void Sema::ActOnCleanupAttr(Decl *D, const Attr *A) {
+  VarDecl *VD = cast<VarDecl>(D);
+  if (VD->getType()->isDependentType())
----------------
to268 wrote:

Well no, if `isDependentType()` is true we would delay (by exiting the function early) till the template has been instantiated before trying to do type checks. After template instantiation, this function is called again and would perform type checks as usual.

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


More information about the llvm-commits mailing list