public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/16320] New: Rejects explicit template parameter type passing for member templates
@ 2004-07-01 19:38 jiri dot volejnik at volny dot cz
  2004-07-01 19:40 ` [Bug c++/16320] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: jiri dot volejnik at volny dot cz @ 2004-07-01 19:38 UTC (permalink / raw)
  To: gcc-bugs

Template member method cannot be called from within another template function or template class if 
the compiler cannot deduce template parameter types itself. The compiler rejects explicit template 
parameter type passing in this case. If template parameter types are passed explicitly to member 
template from non-template function or method, everything is ok. Here is the example:

class A {
public:
	template <class T> void f() {} // T not "deducable"
	template <class T> void f(T) {} // T "deducable"
};

void f(A& a)
{
	a.f<int>(); // ok
	a.f(int(0)); // ok
}

template <class T> void ft(A& a) // same as f(), but template
{
	a.f<int>(); // error: parse error before '>' token 
	a.f(int(0)); // ok
}

int main (int argc, char * const argv[]) {
	A a;
	a.f<int>(); 
	a.f(int(0));
	f(a);
	ft<int>(a);
	return 0;
}

-- 
           Summary: Rejects explicit template parameter type passing for
                    member templates
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jiri dot volejnik at volny dot cz
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: powerpc-mac-os x


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/16320] Rejects explicit template parameter type passing for member templates
  2004-07-01 19:38 [Bug c++/16320] New: Rejects explicit template parameter type passing for member templates jiri dot volejnik at volny dot cz
@ 2004-07-01 19:40 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-01 19:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-01 19:40 -------
This is a dup of the second most reported bug, 795.

*** This bug has been marked as a duplicate of 795 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE
   Target Milestone|---                         |3.4.0


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-07-01 19:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-01 19:38 [Bug c++/16320] New: Rejects explicit template parameter type passing for member templates jiri dot volejnik at volny dot cz
2004-07-01 19:40 ` [Bug c++/16320] " pinskia at gcc dot gnu dot org

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