public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/3784: function not found...
@ 2003-01-03  5:26 Nathanael Nerode
  0 siblings, 0 replies; only message in thread
From: Nathanael Nerode @ 2003-01-03  5:26 UTC (permalink / raw)
  To: nathan; +Cc: gcc-prs

The following reply was made to PR c++/3784; it has been noted by GNATS.

From: Nathanael Nerode <neroden@twcny.rr.com>
To: gcc-gnats@gcc.gnu.org, holt@gholt.net, nathan@gcc.gnu.org,
   gcc-bugs@gcc.gnu.org
Cc:  
Subject: Re: c++/3784: function not found...
Date: Fri, 3 Jan 2003 00:21:12 -0500

 I started to track this down. The failure comes from call.c in 
 build_new_function_call somewhere around line 2717, when the call to 
 add_template_candidate fails to add anything.
 
 I put in a dump_node(t,0,stdout) just before the call.
 
 In the working cases, the first node is the template_decl for foo2.  It's 
 chained to the template_decl for X.
 
 In the broken case, it's chained to the template_decl for foo1, which is
 chained to the template_decl for X.
 @4      template_decl    name: @10      type: @3       srcp: test.cxx:3
                          chan: @11      rslt: @12      prms: @13
 @10     identifier_node  strg: foo1     lngt: 4
 
 I'm pretty sure this is wrong.  The tree we're looking at here is, I believe, 
 supposed to be for one overloaded function (foo2).  What does this have to do 
 with foo1?  Nothing.
 
 (Of course it's also possible that add_template_candidate should be able to 
 deal with this properly; I don't think that's the origin of the bug, though.)
 
 First working case:
 --
 template <typename T, unsigned N> class X { };
 
 // template <typename T, int N>       void foo1(X<T,N>);
 template <typename T, unsigned N>  void foo2(X<T,N>);
 
 int main() {
   X<float, 2> x;
   foo2(x);
 }
 --
 
 Second working case:
 --
 template <typename T, unsigned N> class X { };
 
 
 template <typename T, unsigned N>  void foo2(X<T,N>);
 template <typename T, int N>       void foo1(X<T,N>);
 
 int main() {
   X<float, 2> x;
   foo2(x);
 }
 --
 Note that this second case gives *exactly* the same tree dump as the first 
 working case, with no mention of foo1 at all.  Interesting, no?  Whether foo1 
 should be in this tree or not, it should be the same regardless of order of 
 declaration.  This example is why I suspect foo1 shouldn't be in this tree 
 (of course, I could be wrong, and this could be a case of one bug hiding 
 another).
 
 The broken case:
 --
 template <typename T, unsigned N> class X { };
 
 template <typename T, int N>       void foo1(X<T,N>);
 template <typename T, unsigned N>  void foo2(X<T,N>);
 
 
 int main() {
   X<float, 2> x;
   foo2(x);
 }
 --
 
 Next step is to try to figure out why this tree includes foo1 when it 
 shouldn't...


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-01-03  5:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-03  5:26 c++/3784: function not found Nathanael Nerode

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).