function template specialization problem

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

 



Hi, I don't know if this is a C++ or g++ problem, but this snippet
doesn't compile, but I think it should:

template <class T> void test(const char *par);

template <> void test<int>(const char *par = 0) {}

int main()
{
    test<int>();
}

g++ 3.4.5 returns the following errors:
test.cpp:3: error: default arguments are only permitted for function parameters
test.cpp:7: error: no matching function for call to `test()'

Well, the first error text is a little bit misleading because I'm
defining a default argument for a function parameter, but somehow this
is not parsed correctly, and g++ thinks it's not a function.

So, is this allowed in c++ or is a g++ parse bug?

Thanks,
Rodolfo Lima.

	

	
		
_______________________________________________________ 
Yahoo! doce lar. Faça do Yahoo! sua homepage. 
http://br.yahoo.com/homepageset.html 


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux