https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118195

            Bug ID: 118195
           Summary: accepted template member definition with a different
                    template-head
           Product: gcc
           Version: 14.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ing.russomauro at gmail dot com
  Target Milestone: ---

With this example:

https://godbolt.org/z/YMxbrY5rP

I had previously posted what I supposed to be a bug for clang (and MVSC) ->
https://github.com/llvm/llvm-project/issues/119745 (don't care the MVSC link)

but clang team notified that the code rejection matches the standard
requirements.


In the linked example, there is a template class A2,
for which a function member A2::f is declared:

template<C T>
class A2{
    template<C2<A2> Tnest>
    void f();

    ....
};


which is lated defined outside the class


template<C T>
template<typename Tnest>
requires C2<Tnest, A2<T>>
void A2<T>::f(){};


in a way such that the same concept C2 is applied to the type-parameter Tnest,
but in a different position.

gcc accepts it (please, note it happens also after having added the suggested
flags "-Wall -Wextra -fno-strict-aliasing -fwrapv"),
but clang team notified that the template-head should be the same between
declaration and definition, isn't it ?

Reply via email to