[clang] Reland [Clang] skip default argument instantiation for non-defining friend declarations to meet [dcl.fct.default] p4 (PR #115487)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 16 14:30:59 PST 2024


================
@@ -4692,6 +4692,17 @@ bool Sema::InstantiateDefaultArgument(SourceLocation CallLoc, FunctionDecl *FD,
                                       ParmVarDecl *Param) {
   assert(Param->hasUninstantiatedDefaultArg());
 
+  // FIXME: We don't track member specialization info for non-defining
+  // friend declarations, so we will not be able to later find the function
+  // pattern. As a workaround, don't instantiate the default argument in this
+  // case. This is correct per wording and only an error recovery issue, as per
----------------
erichkeane wrote:

I messed with this for a little bit and can't come up with any good way to hit this with a recoveryexpr/etc, so I think I'm probably ok leaving this as a 'fixme'.  I think we could/do better here someday if we can come up with an example, but nothing I can conceive now.

@a-tarasyuk : feel free to merge this now, and revisit if/when you think of a good repro here that we can examine/improve.

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


More information about the cfe-commits mailing list