------- Comment #2 from pinskia at gcc dot gnu dot org  2008-01-20 01:49 -------
This is accepted for the same reason why the code you have is accepted:
       std::cout << max<unsigned>(3u, -1) << std::endl;


If we write the second max as:
template<typename T, typename... Args> T max( T a, T b, Args... args )
{
   return a > max(b, args...) ? a : max(b, args...);
}

We get a correct rejection so this is not a bug.

t.cc: In function 'T max(T, T, Args ...) [with T = unsigned int, Args = int]':
t.cc:17:   instantiated from here
t.cc:11: error: no matching function for call to 'max(unsigned int&, int&)'
t.cc:11: error: no matching function for call to 'max(unsigned int&, int&)'


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34877

Reply via email to