Uros had the idea of using std::min/max instead of our MIN/MAX
macros defined in system.h.  I thought I would do this cleanup,
but very soon I ran into a problem of failed template argument
substitution: std::min/max function templates require that both
arguments be of the same type:

/home/marek/src/gcc/gcc/caller-save.c: In function ‘void 
replace_reg_with_saved_mem(rtx_def**, machine_mode, int, void*)’:
/home/marek/src/gcc/gcc/caller-save.c:1151:63: error: no matching function for 
call to ‘min(int, short unsigned int)’
      offset -= (std::min (UNITS_PER_WORD, GET_MODE_SIZE (mode))
                                                               ^
In file included from /usr/include/c++/5.1.1/bits/char_traits.h:39:0,
                 from /usr/include/c++/5.1.1/string:40,
                 from /home/marek/src/gcc/gcc/system.h:201,
                 from /home/marek/src/gcc/gcc/caller-save.c:21:
/usr/include/c++/5.1.1/bits/stl_algobase.h:195:5: note: candidate: 
template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^
/usr/include/c++/5.1.1/bits/stl_algobase.h:195:5: note:   template argument 
deduction/substitution failed:
/home/marek/src/gcc/gcc/caller-save.c:1151:63: note:   deduced conflicting 
types for parameter ‘const _Tp’ (‘int’ and ‘short unsigned int’)
      offset -= (std::min (UNITS_PER_WORD, GET_MODE_SIZE (mode))

We can work around this by using casts, but that seems too ugly a solution.
So it appears to me that we're stuck with our MIN/MAX macros.

Thoughts?

        Marek

Reply via email to