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]

AW: G++ Bug in finding template instanciation


|> > The attached source doesn't compile, at least under Windows.
|> > Apparently, the compiler is having trouble finding the template
|> > function which takes the references to the nested class; unnest
|> > Iter, and it works.

|> Thanks for your bug report. I believe the bug is in your code, and
|> not in the compiler. In the operator-, the template parameter only
|> appears in non-deduced contexts (14.8.2.4/4, see also example
|> 14.8.2.4/14). Therefore, template argument deduction fails for this
|> template candidate. As a result, the compiler ends up with no
|> candidates, and the program is ill-formed.

Thank you for taking the time to analyse my problem.  But I still
don't understand the relevance of the quoted passages to the program
in question.  According to 14.8.2.4/4, there are only two nondeduced
contexts.  The first involves specifier-id, and is obviously (I think)
irrelevant.  The second is a bit more complicated: "A type that is a
template-id in which one or more of the template-arguments is an
expression that references a template-parameter."  I'll admit that I
have a great deal of difficulty understanding this, but I don't see
anywhere where it could apply.  Could you be more specific?  Or should
I ask in comp.std.c++: frankly, I don't see how anyone can make head
or tails out of the template chapter.

Note that if you are right, and this code is illegal, we have a real
problem in the standard.  Normally, one would expect that all of the
iterators (other than the raw pointers) would be nested classes, as in
my example.  There is certainly nothing in the standard that I can see
which would forbid it, and it would seem the most natural solution.
However, any such an implementation would run into the same problem.
Results, you cannot reliably call copy (or any of the other
algorithms, for that matter) with an iterator from one of the standard
containers.

The fact that the current implementations don't use a nested class is
doubtlessly due to the fact that when Stepanov originally developped
the code, most compilers couldn't handle nested classes in a class
template, and that no one has since bothered to clean up his work --
if it ain't broke, don't fix it.

--
James Kanze                               mailto:kanze@gabi-soft.de
Conseils en informatique orientée objet/
                   Beratung in objektorientierter Datenverarbeitung
Ziegelhüttenweg 17a, 60598 Frankfurt, Germany Tel. +49(069)63198627

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