This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/15910] can't compile self defined void distance(std::vector<T>, std::vector<T>)
- From: "giovannibajo at libero dot it" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Aug 2004 13:21:39 -0000
- Subject: [Bug libstdc++/15910] can't compile self defined void distance(std::vector<T>, std::vector<T>)
- References: <20040610143911.15910.king.benjamin@mh-hannover.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From giovannibajo at libero dot it 2004-08-03 13:21 -------
Subject: Re: can't compile self defined void distance(std::vector<T>, std::vector<T>)
bangerth at dealii dot org wrote:
> However,
> I don't know whether the standard allows us to actually check these
> requirements on template arguments in a way that not only rejects a
> program in which they are not satisfied, but rather
> _reject a given function from the overload set_ and allows us to pick
> a different function.
You do realize that this happens only because ::distance() is defined with name
"distance", has 2 parameters, and it is called with (at least) one argument
from namespace std, right? Do you really believe it makes sense to reject this
very special situation and allow any other orthogonally similar use of such a
function?
W are also allowed to define std::distance with a different prototype under the
as-if rule if we want to, and I think this improves the C++ experience for the
user, that is, we have a better compiler if we do.
I can agree (as I said) that we are not literally *forced* to do it, but not
that it would not be better doing it. This is why I haven't changed back
'enhancement' to 'rejects-valid'. Note that I still personally think it is
valid code, though.
Giovanni Bajo
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15910