Date
2023-12-15.00:00:00
Message id
7580

Content

(From submission #482.)

Consider:

  template<typename T>
  concept C = sizeof(T) > sizeof(char);
  template<typename T>
  concept D = sizeof(T) > sizeof(int) ;

  template<typename T>
  struct A 
  {
    template<typename U>
    constexpr int f(U) requires C<U> { return 0; }

    template<>
    constexpr int f(int) requires D<T> { return 1; }
  };

  static_assert(A<int>().f(0) == 0);   // #1

There is substantial implementation variance: GCC does not allow explicit specializations of function templates at class scope (contrary to the rule change introduced by issue 727), clang rejects them if a trailing-requires-clause is present, and EDG accepts, but ignores the constraint, causing #1 to fail.