This is the mail archive of the gcc-bugs@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]

Internal error in egcs 1.0.1



>>>>> "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



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