This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
member function templates in class template (C++)
- From: Yujie Wu <yujie dot wu at hec dot utah dot edu>
- To: bug-gcc at gnu dot org
- Date: Tue, 11 Feb 2003 12:08:40 -0700
- Subject: member function templates in class template (C++)
Complete C++ source code:
------------------------------------------------------------------------------------------------------
template <class T, class A = int >
struct AA
{
void foo( int );
template <typename M> void foo( int );
void foo( );
template <typename M> void foo( );
};
template <class T, class A>
inline void AA<T, A>::foo( int )
{
}
template <class T, class A>
inline void AA<T, A>::foo()
{
}
int main()
{
AA<int> a;
a.foo();
}
------------------------------------------------------------------------------------------------------
Errors:
------------------------------------------------------------------------------------------------------
g++ 1.cc
1.cc:14: expected 2 levels of template parms for `void AA<T, A>::foo(int)', got 1
1.cc:21: expected 2 levels of template parms for `void AA<T, A>::foo()', got 1
1.cc:5: confused by earlier errors, bailing out
------------------------------------------------------------------------------------------------------
$ g++ --version
g++ (GCC) 3.2.1
Copyright (C) 2002 Free Software Foundation, Inc.
Platform:
Cygwin DLL version: 1.3.18 on Windows XP Home Edition Ver 5.1 Build 2600 Service Pack 1
Please let me know if this has already been fixed in any newer versions
or there is any workrounds. Thanks in advance!
Best regards,
Yujie Wu