bug-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

template class instantiation as default argument


From: Frank van Viegen
Subject: template class instantiation as default argument
Date: Fri, 4 Feb 2005 20:40:05 +0100
User-agent: KMail/1.7.2

g++ 3.3.5 is unable to use instantiations of templated classes with more than 
one template argument as default arguments of class methods. Not sure if I've 
got the terminology right here, so please have a look at the example code 
below. It shows 4 very similar function/method declarations, of which only 
the last one fails to pass the compiler.

Thanks,
Frank van Viegen

======== g++ version ========
Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.5/specs
Configured with: ../src/configure -v 
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr 
--mandir=/usr/share/man --infodir=/usr/share/info 
--with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared 
--with-system-zlib --enable-nls --without-included-gettext 
--enable-__cxa_atexit --enable-clocale=gnu --enable-debug 
--enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i486-linux
Thread model: posix
gcc version 3.3.5 (Debian 1:3.3.5-5)

======== example code ========
template <class X>
class A
{
};

template <class X, class Y>
class B
{
};

void testA1( A<int> a = A<int>() );
    // Ok

void testB1( B<int,int> b = B<int,int>() );
    // Ok


class Test
{
public:

    void testA2( A<int> a = A<int>() );
    // Ok

    void testB2( B<int,int> b = B<int,int>() );
    // example.cpp:25: error: parse error before `>' token

};




reply via email to

[Prev in Thread] Current Thread [Next in Thread]