[clang] [Clang] Fix dependent local class instantiation bugs (PR #134038)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 2 06:49:43 PDT 2025


================
@@ -4264,7 +4264,8 @@ Sema::InstantiateClassMembers(SourceLocation PointOfInstantiation,
       if (FunctionDecl *Pattern =
               Function->getInstantiatedFromMemberFunction()) {
 
-        if (Function->isIneligibleOrNotSelected())
+        if (!Instantiation->getDeclContext()->isDependentContext() &&
----------------
zyn0217 wrote:

It does instantiate the function declarations in the dependent context. In fact this fixes a bug introduced in clang 15: we skipped the instantiation of local classes here because they're not correctly marked "eligible" because the context the class lives in is dependent.

On the other hand I'm not quite clear if it is suitable to jump past any instantiations at all. it might be an incorrect optimization, but again I'm not quite familiar with the proposal that introduced this line.

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


More information about the cfe-commits mailing list