This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

egcs-1.0 -frepo problem


Hi,

I have a problem with the appended code snippet. As it is it will compile
with gcc-2.7.2 with included repo patch. However, this is not true for
egcs-1.0. Using egcs-1.0 without -frepo is ok, on using it with -frepo
I have to define USE_EXPLICIT_TEMPLATE to get this explicit template.

My system: Linux i586 RedHat 4.1, binutils-2.8.1.0.1-1, libc-5.4.36-1

Thanks,
	Andreas
--------------------------------------------------------------------------------
template <class LIST, class T, class CMP>
void lsort(LIST& l, CMP& cmp, T* dummy)
{
  // just for fun, here we do nothing
} 
 
template <class T>
class list {
public:
  void sort(int (*cmp)(const T&, const T&)) {
    lsort(*this, cmp, (int*)0);
  }
};
 
//#define USE_EXPLICIT_TEMPLATE
// If USE_EXPLICIT_TEMPLATE is not defined, then compiling will result in
// a undefined reference linker error on EGCS-1.0 with -frepo. Compiling
// without -frepo is ok.
//
// However, if we compile once with USE_EXPLICIT_TEMPLATE creating a
// suitable .rpo file, then we may undefine USE_EXPLICIT_TEMPLATE as long as
// the .rpo file is not removed!!
#if defined(USE_EXPLICIT_TEMPLATE)
template void lsort <list<int>, int, int (*)(int const &, int const &)>
(list<int> &, int (*)(int const &, int const &), int *);
#endif


int my_cmp(const int& a, const int& b)
{
  return 1;
}

int main()
{
  list<int> a;
  a.sort(my_cmp);
}



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]