Article View: gnu.g++.bug
Article #174bug with functions/templates
From: Thomas M. Breuel
Date: Mon, 27 Jul 1992 17:45
Date: Mon, 27 Jul 1992 17:45
29 lines
1438 bytes
1438 bytes
I'm not sure whether I have reported this before; in any case, it's
broken in 2.2.2.
template <class F,class X>
X apply(F f,X x) {
return f(x);
}
float f(float x) {
return x*x;
}
main() {
return int(apply(f,float(3.0)));
}
cd /fs/vision01/tmb/src/char/
gcc -v -c foo.cc
Reading specs from /sym/gnu/lib/gcc-lib/sparc/2.2.2/specs
gcc version 2.2.2
/sym/gnu/lib/gcc-lib/sparc/2.2.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 /tmp/cca22708.i
GNU CPP version 2.2.2 (sparc)
/sym/gnu/lib/gcc-lib/sparc/2.2.2/cc1plus /tmp/cca22708.i -quiet -dumpbase foo.cc -version -o /tmp/cca22708.s
GNU C++ version 2.2.2 (sparc) compiled by GNU C version 2.2.2.
foo.cc: In function `int main ()':
foo.cc:11: bad argument 0 for function `apply__F?f (<unknown type>, float)' (type was <unknown type>)
foo.cc:12: warning: control reaches end of non-void function
Compilation exited abnormally with code 1 at Mon Jul 27 15:45:20
Technical Details
Message-ID:
<9207271345.AA15860@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: bug with functions/templates Message-ID: <9207271345.AA15860@idiap.ch> Sender: gnulists@ai.mit.edu Reply-To: tmb@idiap.ch Organization: GNUs Not Usenet Distribution: gnu Date: Mon, 27 Jul 1992 17:45:50 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 30