[Insight-users] Explicit Instantiation question
Rupert Brooks
rupe.brooks at gmail.com
Mon Nov 5 15:16:56 EST 2007
No, that trivial code does not cause the error. Neither does the
slightly less trivial one below...
GCC seems to have had related bugs in the past.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8691
--Rupert
template <class T>
class top {
public:
top();
~top(){};
T topfun(T);
};
template<class T>
class foo:public top<T>
{
protected:
foo();
~foo(){};
void bar(T);
};
extern template class foo<int>;
On 11/5/07, Brad King <brad.king at kitware.com> wrote:
> Rupert Brooks wrote:
> > Its worth mentioning that this g++ might be strange. Its on a
> > cluster, and so by default set up to compile and link in MPI
> > libraries. I've tried to eliminate that default and thus any
> > interference that may cause, but who knows, there could be a
> > configuration issue i am unaware of.
> >
> > Like I said - i dont really expect an answer to this one. Just reporting....
> [snip]
> > will compile and run without problems in Visual C++ 2003 and gcc 4.0.3
> > on Ubuntu Linux. However, with this gcc
> >
> > [rbrooks at hn Release]$ g++ -v
> > Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs
> > Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
> > --infodir=/usr/share/info --enable-shared --enable-threads=posix
> > --disable-checking --with-system-zlib --enable-__cxa_atexit
> > --host=i386-redhat-linux
> > Thread model: posix
> > gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
> > [rbrooks at hn Release]$
> >
> > compiling with the -O3 option causes the error below, which does NOT
> > occur with -O2 or no -O option
>
> That is certainly unusual. I tried gcc 3.2.3 and still did not get the
> error for a trivial test case:
>
> template <class T> struct A
> {
> void foo(T) {}
> void bar(T);
> };
> template class A<int>;
>
> Do you get the error for this code?
>
> -Brad
>
--
--------------------------------------------------------------
Rupert Brooks
McGill Centre for Intelligent Machines (www.cim.mcgill.ca)
Ph.D Student, Electrical and Computer Engineering
http://www.cyberus.ca/~rbrooks
More information about the Insight-users
mailing list