public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/10414: error in compiling a template
@ 2003-04-15 13:56 Adrin_Jalali
  0 siblings, 0 replies; 2+ messages in thread
From: Adrin_Jalali @ 2003-04-15 13:56 UTC (permalink / raw)
  To: gcc-gnats; +Cc: adrin_jalali


>Number:         10414
>Category:       c++
>Synopsis:       error in compiling a template
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 15 13:56:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     adrin jalali
>Release:        gcc 3.2
>Organization:
>Environment:
Linux Redhat 7.3 & Linux Redhat 8.0
>Description:
#include <stdio.h>

class First
{
	public :
		template <class T>
		T *Func(int i)
		{
			printf("%d", i);
			return new T;
		} // End of : template <class T> T *Func(int i)
}; // End of : class First

class Second
{
	private :
		First *m_Member;
	public :
		Second(void)
		{
			m_Member = new First;
		} // End of : Second(void)

		template <class T>
		T *f(int i)
		{
			return m_Member->Func<T>(i);
		} // End of : template <class T> T *f(int i)
}; // End of : class Second

int main(void)
{
	Second a;
	a.f<int>(10);
} // End of : int main(void)
>How-To-Repeat:

>Fix:
May be it can be fixed by naming 2 functions the same.
>Release-Note:
>Audit-Trail:
>Unformatted:


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

* Re: c++/10414: error in compiling a template
@ 2003-04-15 15:17 bangerth
  0 siblings, 0 replies; 2+ messages in thread
From: bangerth @ 2003-04-15 15:17 UTC (permalink / raw)
  To: Adrin_Jalali, adrin_jalali, gcc-bugs, gcc-prs, nobody

Synopsis: error in compiling a template

State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Tue Apr 15 15:17:27 2003
State-Changed-Why:
    Not a bug. You need to write
      return m_Member->template Func<T>(i);
    
    W.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10414


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

end of thread, other threads:[~2003-04-15 15:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-15 13:56 c++/10414: error in compiling a template Adrin_Jalali
2003-04-15 15:17 bangerth

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