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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-10-30
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed. reduced testcase:
template <class T> constexpr const T min(const T t0, const T t1) { return 0; }
template<int MAX>
struct Matrix{
    template<int MAXOP, int other_MAXOP>
friend Matrix<min(MAXOP, other_MAXOP)>
operator+(Matrix<MAXOP> const& lhs, Matrix<other_MAXOP> const& rhs);
};

template<int MAXOP, int other_MAXOP>
Matrix<min(MAXOP, other_MAXOP)>
operator+(Matrix<MAXOP> const& lhs, Matrix<other_MAXOP> const& rhs);

void f()
{
    Matrix<1> a;
    a+a;
}

---- CUT ----
Note the min function inside the return type is important and is looking like
is what is causing issues to not match the two decls to be the same.
Having min as a non-template function allows it to be matched.

Reply via email to