Article View: gnu.g++.bug
Article #1341type unification fails errorneously in gcc 2.3.2
From: Thomas M. Breuel
Date: Wed, 06 Jan 1993 21:32
Date: Wed, 06 Jan 1993 21:32
48 lines
2082 bytes
2082 bytes
There seems to be some bizarre failure in the type unification code.
[As an aside, shouldn't GNU C++ try to print syntactically correct
error messages? The error message contains the type "struct
Stk<Stk<int>>", which is not valid C++".]
cd /fs/vision01/tmb/src/rec-character/
gcc -c -v foo.cc
Reading specs from /sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.2/specs
gcc version 2.3.2
/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.2/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix foo.cc /local/tmp/cca20583.i
GNU CPP version 2.3.2 (sparc)
/sym/gnu/lib/gcc-lib/sparc-sun-sunos4.1/2.3.2/cc1plus /local/tmp/cca20583.i -quiet -dumpbase foo.cc -version -o /local/tmp/cca20583.s
GNU C++ version 2.3.2 (sparc) compiled by GNU C version 2.3.2.
foo.cc: In function `void restore (struct _iobuf*, struct Stk<Stk<int>>&)':
foo.cc:17: type unification failed for function template `restore'
Compilation exited abnormally with code 1 at Wed Jan 6 20:29:06
================================================================
extern "C" {
#include <stdio.h>
}
template <class T>
struct Stk {
T t[100];
int fill;
T &operator()(int i) {return t[i];}
};
template <class T>
void restore(FILE *stream,Stk<T> &stack) {
int l;
fread(&l,sizeof l,1,stream);
stack.fill = l;
for(int i=0;i<l;i++) restore(stream,stack(i));
}
void restore(FILE *stream,int &x) {
fread(&x,sizeof x,1,stream);
}
main() {
Stk< Stk<int> > foo; // this works fine with Stk<int>
restore(stdin,foo);
}
================================================================
Technical Details
Message-ID:
<9301061932.AA20907@idiap.ch>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!idiap.CH!tmbShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!idiap.CH!tmb From: tmb@idiap.CH (Thomas M. Breuel) Subject: type unification fails errorneously in gcc 2.3.2 Message-ID: <9301061932.AA20907@idiap.ch> Sender: gnulists@ai.mit.edu Reply-To: tmb@idiap.ch Organization: GNUs Not Usenet Distribution: gnu Date: Wed, 6 Jan 1993 21:32:20 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 49