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: "gdr at integrable-solutions dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Aug 2004 13:01:14 -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 gdr at integrable-solutions dot net 2004-08-03 13:01 -------
Subject: Re: can't compile self defined void distance(std::vector<T>, std::vector<T>)
"giovannibajo at libero dot it" <gcc-bugzilla@gcc.gnu.org> writes:
| ------- Additional Comments From giovannibajo at libero dot it 2004-08-03 12:48 -------
| Subject: Re: can't compile self defined void distance(std::vector<T>, std::vector<T>)
|
| gdr at integrable-solutions dot net wrote:
|
| >> Is there *anything* in the standard saying that the code is actually
| >> illegal?
| >> This is a rejects-valid IMO.
|
| > Can you elaborate on why you believe this is a reject a valid?
|
| Because I think that picking up std::distance by Koenig lookup and having it
| *abort compilation* instead of being reject as an invalid overload is just an
| unintended side effect of the implementation.
I'm more interested in chapter and verse, since you stated that this
is a reject-valid.
| If you want to push it, it might
| be an unintended side-effect of the standard - fine, the standard is broken.
Then, take it to the C++ standards committee.
| But I won't never buy that the code is rightfully ill-formed as-is. It breaks
It is fundamentally broken as per the current standard. If you
think the standard is broken, then take it to the committee and fix
the standard.
[...]
| Or maybe, we could have a way to use enable_if using as condition "does
| iterator_traits<T> have a nested difference_type?".
You could use iterator_traits, but again the code is fundamentally
broken. Papering over the problem is the wrong thing to do. A broken
code should explose as soon as possible. Otherwise, a QoI we don't do
a good job at spotting broken or dubious or non-portable codes.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15910