public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* function template specialization problem
@ 2006-03-21 19:13 rodolfo
  2006-03-21 19:47 ` Andrew Haley
  2006-03-21 22:10 ` Daniel Llorens del Río
  0 siblings, 2 replies; 3+ messages in thread
From: rodolfo @ 2006-03-21 19:13 UTC (permalink / raw)
  To: gcc-help

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 847 bytes --]

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 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-03-21 22:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-21 19:13 function template specialization problem rodolfo
2006-03-21 19:47 ` Andrew Haley
2006-03-21 22:10 ` Daniel Llorens del Río

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).