clang-concepts-monorepo
clang-concepts-monorepo copied to clipboard
Friend declarations are not working?
template <typename>
concept AnyType = true;
template <AnyType ... types>
class configuration
{
//!\brief Friend declaration for other instances of the configuration.
template <AnyType ... _types>
friend class configuration;
};
int main()
{
configuration<>{};
return 0;
}
error: associated constraints differ in template redeclaration
<source>:14:5: note: in instantiation of template class 'configuration<>' requested here
configuration<>{};
^
note: template is declared here
The confusing thing is that the error log is truncated and that the friend is not working.
The example works if I remove the friend declaration or exchange AnyType
with typename
.
See https://godbolt.org/z/iXkRlP
And a follow-up question:
Is it allowed to change the constraints in the friend declaration?
template <AnotherType ... _types> // constraint differently
friend class configuration;