================
@@ -1836,7 +1836,19 @@ static TemplateParameterList 
*GetTemplateParameterList(TemplateDecl *TD) {
   // Make sure we get the template parameter list from the most
   // recent declaration, since that is the only one that is guaranteed to
   // have all the default template argument information.
-  return cast<TemplateDecl>(TD->getMostRecentDecl())->getTemplateParameters();
+  Decl *ND = TD->getMostRecentDecl();
+  // Skip past friend Decls because they are not supposed to contain default
+  // template arguments. Moreover, these declarations may introduce template
+  // parameters living in different template depths than the corresponding
+  // template parameters in TD, causing unmatched constraint substitution.
+  //
+  // C++23 N4950 [temp.param]p12
----------------
Sirraide wrote:

> I referenced that number because I'm concerned the paragraphs/wordings could 
> vary across standards. :) (Maybe I should use an earlier standard file number 
> where this line first appears...?)

The [stable.names] should never change afaik; as for the paragraphs, it happens 
to be the same one even in the C++14 standard for this one, so I think it’s 
fine. You can probably also just reference the C++14 standard if that’s what 
you prefer.

https://github.com/llvm/llvm-project/pull/86914
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to