templated specializations get emitted in 3.3?

Benjamin Kosnik bkoz@redhat.com
Wed May 28 21:12:00 GMT 2003


I don't think this is a bug. 

What you are doing is providing a definition of a non-inlined member
specialization in a header file: this is just like putting a definition
of a non-inlined class member function in a header. 

Behavior of this has definitely changed, but the current behavior seem
defensible. Note if you add "inline" you'll have consistent behavior.

-benjamin



template<class X> class Box
{
  X content;

public:
  Box()
  { content=0; }

  int print() { return 0; }
};

template<> 
//int
inline int
Box<long>::print() 
{ return 1; }


// g++ head
// default : T
// inline : (no symbol)

// g++ 3.2.2
// default : (no symbol)
// inline : (no symbol)

// icc 7.1
// default : W
/*
00000000 W Box<long>::print()
00000000 d _ZN3BoxIlE5printEv$$LSDA
*/
// inline : (no symbol)



More information about the Gcc mailing list