mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-27 19:56:06 +00:00

Per [[class.friend]p6](http://eel.is/c++draft/class.friend#6) a friend function shall not be defined if its name isn't unqualified. A _template-id_ is not a name, meaning that a friend function specialization does not meet this criteria and cannot be defined. GCC, MSVC, and EDG all consider friend function specialization definitions to be invalid de facto explicit specializations and diagnose them as such. Instantiating a dependent friend function specialization definition [currently sets off an assert](https://godbolt.org/z/Krqdq95hY) in `FunctionDecl::setFunctionTemplateSpecialization`. This happens because we do not set the `TemplateSpecializationKind` of the `FunctionDecl` created by template argument deduction to `TSK_ExplicitSpecialization` for friend functions [here](https://github.com/llvm/llvm-project/blob/main/clang/lib/Sema/SemaTemplate.cpp#L9600). I changed the assert condition because I believe this is the correct behavior.
See llvm/docs/README.txt