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:13:59 -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:13 -------
Subject: Re: can't compile self defined void distance(std::vector<T>, std::vector<T>)
gdr at integrable-solutions dot net wrote:
>> 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.
I don't see anything in the standard that tells me I cannot define a function
called "distance" in the global namespace. Nor that if I do it, I must call it
with an explicit scope specification. Hence, the code is valid, just like I can
define a function named "distance2". Bring me your chapter and verse which
tells that the code is ill-formed.
Really, are you implying that the committee *explicitally* wanted to avoid such
a case while writing the standard? It looks obvious to me that it would be
*great* if the code worked as-is, and it is just an unfortunate chain of events
(complex language rules) which break compilation.
I doubt we will ever going to agree here, Gaby. Really, I doubt it. The core
here is: I think it is correct by large common sense, I think it is crystal
clear that it is correct. So crystal clear that it took about 10 comments to
Wolfgang and me[1] understand why GCC was rejecting the code. You are defending
side-effects of complex language rules on normal-looking code as an explanation
of why it is invalid. You have the right of doing so, of course. Moreover, you
are the v3 maintainer, so I think I am out of luck here.
Giovanni Bajo
[1] and we both know C++ at a decent level, I presume.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15910