This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/34877] Invalid conversion in lookup of variadic template
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Jan 2008 01:49:55 -0000
- Subject: [Bug c++/34877] Invalid conversion in lookup of variadic template
- References: <bug-34877-15404@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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