[Bug c++/36486] g++ accepts code with ambiguous overloading

richard-gccbugzilla at metafoo dot co dot uk gcc-bugzilla@gcc.gnu.org
Wed Jun 11 12:59:00 GMT 2008



------- Comment #3 from richard-gccbugzilla at metafoo dot co dot uk  2008-06-11 12:58 -------
I'm not 100% certain that g++ is at fault. Given that icc, Comeau and MS all
reject it, I'm inclined to think that g++ is probably the one which gets this
wrong, so I've raised this here first.

This hinges on whether f0 and f1 are ordered by the standard partial ordering
on function templates. It appears superficially that they are not, since from
the arguments to f1 you cannot deduce the template parameters of f0, nor vice
versa. However, it appears to depend on interpretation of [temp.deduct.type]/5,
which says that "The non-deduced contexts are: [...] A template parameter used
in the parameter type of a function parameter that has a default argument that
is being used in the call for which argument deduction is being done". I'm not
sure whether that applies here, but if it does, perhaps that makes f1 more
specialized than f0, and this is a bug in all the other compilers.


-- 


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



More information about the Gcc-bugs mailing list