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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The code from the godbolt link is:

#include <concepts>

template<typename T, typename U>
concept weak_same = std::same_as<std::decay_t<T>, U>;

enum struct A {
    x
};

auto f(weak_same<A> auto) {}
auto f(auto&&) {}

auto main()->int {
    f(A::x);
}

The function templates can be rewritten as:


template<typename T> requires weak_same<T, A>
auto f(T) { }
template<typename T>
auto f(T&&) { }

Which shows the difference in function parameters more clearly.

The fixed version would use:

template<typename T> requires weak_same<T, A>
auto f(T&&) { }
template<typename T>
auto f(T&&) { }

Or using the abbreviated syntax:

auto f(weak_same<A> auto&&) {}
auto f(auto&&) {}

Reply via email to