This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]