[clang] [Clang] Fixed a crash when __PRETTY_FUNCTION__ or __FUNCSIG__ (clang-cl) appears in the trailing return type of the lambda (PR #122611)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Jan 12 03:18:20 PST 2025
================
@@ -774,7 +774,15 @@ std::string PredefinedExpr::ComputeName(PredefinedIdentKind IK,
const FunctionDecl *Decl = FD;
if (const FunctionDecl* Pattern = FD->getTemplateInstantiationPattern())
Decl = Pattern;
- const FunctionType *AFT = Decl->getType()->getAs<FunctionType>();
+
+ // The type may not be fully initialized at this point.
+ // For example, in the trailing return type context of the lambda
+ // expression.
----------------
cor3ntin wrote:
```suggestion
// Bail out of the type of the function has not been set yet.
// This can notably happen in the trailing return type of a lambda expression
```
https://github.com/llvm/llvm-project/pull/122611
More information about the cfe-commits
mailing list