saarraz / clang-concepts-monorepo

****** OBSOLETE - CONCEPTS HAS BEEN MERGED INTO CLANG TRUNK AND DEVELOPMENT CONTINUES THERE ****** This fork of llvm-project contains my implementation of C++2a Concepts for the Clang compiler, and will be updated regularly with bug fixes until the whole feature is merged to trunk. Follow the instructions here https://clang.llvm.org/get_started.html to build, then use the flags "-std=c++2a -Xclang -fconcepts-ts" to enable concepts.
27 stars 3 forks source link

Friend declarations are not working? #5

Open marehr opened 5 years ago

marehr commented 5 years ago
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

marehr commented 5 years ago

And a follow-up question:

Is it allowed to change the constraints in the friend declaration?

    template <AnotherType ... _types> // constraint differently
    friend class configuration;