[clang] [clang] Bail out if the result of function template instantiation is not a function. (PR #69449)

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 18 05:59:07 PDT 2023


================
@@ -2649,7 +2649,9 @@ TypeSourceInfo *Sema::SubstFunctionDeclType(TypeSourceInfo *T,
   } else {
     Result = Instantiator.TransformType(TLB, TL);
   }
-  if (Result.isNull())
+  // When clang goes into recovery mode, it might substitute
----------------
sam-mccall wrote:

Not sure "recovery mode" is well-defined enough to refer to in this way

maybe:
When there are errors resolving types, clang may use IntTy as a fallback, breaking our assumption that function declarations have function types.

(I thought there was a name for this usage of IntTy but I can't find one. It happens e.g. at GetFullTypeForDeclarator, SemaType.cpp:5734)

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


More information about the cfe-commits mailing list