public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Possible bug in g++ - template specialization
@ 2009-07-10 11:48 Maciej Cencora
  2009-07-10 12:44 ` Richard Guenther
  0 siblings, 1 reply; 2+ messages in thread
From: Maciej Cencora @ 2009-07-10 11:48 UTC (permalink / raw)
  To: gcc

Hi,

I think I've found a bug in g++. Let's say we have following files:

// a.hpp

template<typename T>
void func1()
{
	// general code
}

// a.cpp

#include "a.hpp"

template<>
void func1<int>()
{
	// specialized code
}

// main.cpp

#include "a.hpp"

int main(void)
{
	func1<int>();
	
	return 0;
}


Now when we run the program compiled with: g++ main.cpp a.cpp -o main
specialized version of func1 will be called, but when compiled with
-Os flag the general version will be called.
I'm not an expert but I believe the -Os behaviour is the correct one.

Please CC me when replying, as I'm not subscribed to the mailing list.

Regards,
Maciej Cencora

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

end of thread, other threads:[~2009-07-10 12:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-10 11:48 Possible bug in g++ - template specialization Maciej Cencora
2009-07-10 12:44 ` Richard Guenther

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).