This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/15910] can't compile self defined void distance(std::vector<T>, std::vector<T>)


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]