[clang] [Clang] Correctly initialize placeholder fields from their initializers (PR #114196)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 5 06:25:42 PST 2024


================
@@ -5560,6 +5560,25 @@ ExprResult Sema::BuildCXXDefaultArgExpr(SourceLocation CallLoc,
                                    Init, InitializationContext->Context);
 }
 
+static FieldDecl *FindFieldDeclInstantiationPattern(const ASTContext &Ctx,
+                                                    FieldDecl *Field) {
+  if (FieldDecl *Pattern = Ctx.getInstantiatedFromUnnamedFieldDecl(Field))
+    return Pattern;
+  auto *ParentRD = cast<CXXRecordDecl>(Field->getParent());
+  CXXRecordDecl *ClassPattern = ParentRD->getTemplateInstantiationPattern();
+  DeclContext::lookup_result Lookup =
+      ClassPattern->lookup(Field->getDeclName());
+  auto Rng = llvm::make_filter_range(Lookup, [] (auto && L) {
----------------
erichkeane wrote:

Oh wait, disregard.  The `L` is a `lookup_result`, not a thing, so I dont think IsaPred works.

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


More information about the cfe-commits mailing list