[clang] [Clang][NFCI] Cleanup the fix for default function argument substitution (PR #104911)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 20 07:49:55 PDT 2024


================
@@ -285,7 +286,8 @@ Response HandleFunction(Sema &SemaRef, const FunctionDecl *Function,
     // If this function was instantiated from a specialized member that is
     // a function template, we're done.
     assert(Function->getPrimaryTemplate() && "No function template?");
-    if (Function->getPrimaryTemplate()->isMemberSpecialization())
+    if (!ForDefaultArgumentSubstitution &&
+        Function->getPrimaryTemplate()->isMemberSpecialization())
----------------
zyn0217 wrote:

Okay, I managed to check every usage of the function where `RelativeToPrimary = true`: Most codes are calling it with `ForConstraintInstantiation = true` as well, except for two places where `RelativeToPrimary = true` but `ForConstraintInstantiation = false`.

One is the default argument substitution, for which we intend to change the behavior.

While looking at the other call site, the noexcept specifier substitution, I hit upon probably another bug: https://clang.godbolt.org/z/MnYbGKoqP @cor3ntin I presume we should accept the code there?

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


More information about the cfe-commits mailing list