[Bug c++/50828] class template parameter not printed for member function template in candidate list

2012-09-24 Thread paolo.carlini at oracle dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50828



Paolo Carlini  changed:



   What|Removed |Added



 Status|ASSIGNED|RESOLVED

 Resolution||FIXED

   Target Milestone|--- |4.8.0



--- Comment #7 from Paolo Carlini  2012-09-24 
16:58:40 UTC ---

Fixed.


[Bug c++/50828] class template parameter not printed for member function template in candidate list

2012-09-24 Thread paolo at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50828



--- Comment #6 from paolo at gcc dot gnu.org  
2012-09-24 16:56:52 UTC ---

Author: paolo

Date: Mon Sep 24 16:56:41 2012

New Revision: 191673



URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191673

Log:

2012-09-24  Paolo Carlini  



PR c++/50828

* error.c (dump_function_decl): Strip TFF_TEMPLATE_NAME from flags

at the outset.



Modified:

trunk/gcc/cp/ChangeLog

trunk/gcc/cp/error.c


[Bug c++/50828] class template parameter not printed for member function template in candidate list

2011-10-23 Thread paolo.carlini at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50828

Paolo Carlini  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2011-10-23
 AssignedTo|unassigned at gcc dot   |paolo.carlini at oracle dot
   |gnu.org |com
 Ever Confirmed|0   |1

--- Comment #5 from Paolo Carlini  2011-10-23 
19:13:51 UTC ---
Looking into it.


[Bug c++/50828] class template parameter not printed for member function template in candidate list

2011-10-22 Thread paolo.carlini at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50828

--- Comment #4 from Paolo Carlini  2011-10-22 
23:39:06 UTC ---
Indeed.

The difference between the two is in flags (primary is true for both of
course): due to the '| TFF_TEMPLATE_NAME' # error.c:1214 in dump_template_decl.
The fact is, toward the end of dump_template_decl there are quite a few of '|
TFF_TEMPLATE_NAME' and before trying removing one we should make sense of the
others.


[Bug c++/50828] class template parameter not printed for member function template in candidate list

2011-10-22 Thread redi at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50828

--- Comment #3 from Jonathan Wakely  2011-10-22 
22:01:12 UTC ---
Changing it would be consistent with the output for non-template member
functions of class templates:

template
  struct A {
void f() { }
  };

int main() {
  A a;
  a.f(0);
}

t.C: In function ‘int main()’:
t.C:8:8: error: no matching function for call to ‘A::f(int)’
t.C:8:8: note: candidate is:
t.C:3:10: note: void A::f() [with T = void]
t.C:3:10: note:   candidate expects 0 arguments, 1 provided


[Bug c++/50828] class template parameter not printed for member function template in candidate list

2011-10-22 Thread paolo.carlini at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50828

--- Comment #2 from Paolo Carlini  2011-10-22 
21:39:49 UTC ---
Seems due to the below, ie, no decoration for a primary. Remains to be seen if
in other contexts (in this case the call chain is dump_template_decl ->
dump_function_decl -> dump_type -> dump_aggr_type -> dump_template_parms) we
actually do *not* want decorations, otherwise seems easy to change.

/

/* Dump the template parameters from the template info INFO under control of
   FLAGS. PRIMARY indicates whether this is a primary template decl, or
   specialization (partial or complete). For partial specializations we show
   the specialized parameter values. For a primary template we show no
   decoration.  */

static void
dump_template_parms (tree info, int primary, int flags)
{
  tree args = info ? TI_ARGS (info) : NULL_TREE;

  if (primary && flags & TFF_TEMPLATE_NAME)
return;


[Bug c++/50828] class template parameter not printed for member function template in candidate list

2011-10-22 Thread redi at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50828

--- Comment #1 from Jonathan Wakely  2011-10-22 
13:29:19 UTC ---
I noticed this while analysing PR 42356, the missing template argument makes it
much harder to see why name lookup results are ambiguous

template
  struct A {
template
  void f() { }
  };

struct B : A, A { };

int main() {
  B a;
  a.f();
}

f.C: In function ‘int main()’:
f.C:11:5: error: request for member ‘f’ is ambiguous
f.C:4:12: error: candidates are: template void A::f() [with U = U, T =
void]
f.C:4:12: error: template void A::f() [with U = U, T =
int]

Because T isn't shown in the signature it's not immediately obvious that name
lookup found A::f and A::f in different base classes.