c++/10414: error in compiling a template

Adrin_Jalali@yahoo.com Adrin_Jalali@yahoo.com
Tue Apr 15 13:56:00 GMT 2003


>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:



More information about the Gcc-bugs mailing list