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: "adah at netstd dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Aug 2005 02:41:01 -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 adah at netstd dot com 2005-08-10 02:40 -------
Since I do not think I can find appropriate words to respond to Gaby without
inflaming the discussion, I think I had better suppress my will to argue with
him it for the moment. Not that I want to ignore his messages. On the
contrary, I have read every word. Sorry that I had ignored some of his advice
before. Some was useful. Regret that I am not an expert in the C++ Standard,
as most C++ users are not.
(In reply to comment #66)
> Subject: Re: can't compile self defined void distance(std::vector<T>,
std::vector<T>)
> > This is reasonable. That was why I thought it was not necessary to `fix'
this
> > bug after some discussions. I just thought it was still a bug, and some
> > measures need to be taken to warn the user about this problem. It might be
of
> > low priority, but simply marking it as `INVALID' just covers this problem.
> > More people might discover this bug again and report it again, though they
> > might not be as _____ (fill in adjectives that you like) as I am.
> Even documentioning what the standard say in the non bug section of bug
reporting
> web page, does not help people to read the docs. There is no way really to
fix
> this. Look at the sequence point docs in bug reporting web page and then
look at
> all the dupicate bugs.
> -- Pinski
Now to your point. Please notice that my current stance is not that GCC should
fix this `bug'. I have stated it days ago. But the user's failure is really
UNEXPECTED, and this is a PROBLEM. To avoid this problem, a better diagnostic
message should be emitted. Just try compiling the OP's program to see my point.
My bug report was a duplicate too, but I did do a search on `Koenig'. I did
not search on `distance' because I did not think it was the point.
(In reply to comment #67)
> I think we should all recuse ourselves from this discussion, since we just
> keep iterating our same old positions:
>
> Yongwei believes that this is a defect in the standard and that gcc should
> not follow the standard in this respect.
>
> Gaby and I believe that gcc should follow the standard, and probably both
> believe that the standard does not have a defect in this respect. We believe
I cannot help wondering why (though this might be better discussed on
comp.std.c++: I do hope you can discuss there). IMHO, the current bahaviour is
violating the rationale of the std namespace.
> that changing the standard would require a massive change in the language,
> since it would either a) require the introduction of concepts (so that
> std::distance can only be called with arguments that match the concept
> of an iterator; same for all other similar functions), or b) abandoning
> argument dependent (Koenig) name lookup. Neither sounds like an appealing
If this bug should ever be fixed, I would prefer this approach:
c) Failure to instantiate a template function should automatically remove it
from the candidates of overload resolution.
> idea. We believe that users can work around this perceived problem by
> simply calling
> ::distance (arg1, arg2)
> to get to their own implementation, not the one in std::
Passing this information to the user is difficult, unless GCC emits a
diagnostic message to help users do so, as GCC is currently doing on the
missing of `typename'.
> Since we can't seem to find an agreement, let's just leave it at that.
>
> W.
I am not an unreasonable person. I just want to see a reasonable ending.
Yongwei
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15910