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

            Bug ID: 107429
           Summary: misdiagnosed "constraint depends on itself" in
                    overloaded functions
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jwjagersma at gmail dot com
  Target Milestone: ---

Given the following code:

  struct tag_foo { } inline constexpr foo;
  struct tag_bar { } inline constexpr bar;

  template<typename... T>
  auto f(tag_foo, T... x)
  {
    return (x + ...);
  }

  template<typename... T>
  concept fooable = requires (T... x) { f(foo, x...); };

  template<typename... T> requires (fooable<T...>)
  auto f(tag_bar, T... x)
  {
    return f(foo, x...);
  }

  auto test()
  {
    return f(bar, 1, 2, 3);
  }

g++ claims that "satisfaction of atomic constraint [...] depends on itself",
but the overload of 'f()' that is checked by 'fooable' is not constrained in
any way.

I am not 100% sure if this is valid code, but clang and msvc do not make the
same complaint, so I'm inclined to believe g++ is in error here.

Reply via email to