This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Internal error in egcs 1.0.1
- To: "Adam P. Jenkins" <ajenkins at cs dot umass dot edu>
- Subject: Internal error in egcs 1.0.1
- From: Mark Mitchell <mmitchell at usa dot net>
- Date: Thu, 22 Jan 1998 18:09:48 GMT
- Cc: egcs-bugs at cygnus dot com
- References: <199801201857.NAA01275@cmpsci9.cs.umass.edu>
- Reply-To: mmitchell at usa dot net
>>>>> "Adam" == Adam P Jenkins <ajenkins@cs.umass.edu> writes:
Adam> Hi, I get an internal compiler error when compiling the
Adam> following code with egcs 1.0.1. I know that the code below
Adam> ------------------ tmp.cc ---------------- #include <algo.h>
Adam> template <class FI, class T> inline T sumsq(FI first, FI
Adam> last) { struct { T operator()(T acc, T x) { return acc +
Adam> x*x; } } plussq; return accumulate(first, last, (T)0,
Adam> plussq); }
Adam> int main() { int i[10]; return sumsq(i, i + 10); }
Adam> -------------------------------------------
You now get two errors: first that sumsq is not fully specified (there
is no way to deduce the template argument T):
bug1.cc: In function `int main()':
bug1.cc:15: incomplete type unification
bug1.cc:15: no matching function for call to `sumsq (int[10], int *)'
Fixing that, by writing sumsq<int*, int> leads to this message:
quickstep.stanford.edu% test-g++ -c bug1.cc
bug1.cc: In function `int sumsq<int *, int>(int *, int *)':
bug1.cc:9: type `sumsq<int *, int>(int *, int *)::sumsq<int *, int>(int *, int *)::._7<int *,int>' composed from a local class is not a valid template-argument
bug1.cc:9: trying to instantiate `template <class InputIterator, class T, class BinaryOperation> accumulate(InputIterator, InputIterator, T, BinaryOperation)'
bug1.cc:9: no matching function for call to `accumulate (int *&, int *&, int, sumsq<int *, int>(int *, int *)::sumsq<int *, int>(int *, int *)::._7<int *,int> &)'
So, this one is fixed.
--
Mark Mitchell mmitchell@usa.net
Stanford University http://www.stanford.edu