help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Compiling Octave 3.2.3 with icpc 10.1 fails: more than one instance


From: RUSS BRENNAN
Subject: RE: Compiling Octave 3.2.3 with icpc 10.1 fails: more than one instance of overloaded function "octave_int_cmp_op::mop"
Date: Sun, 22 Aug 2010 09:56:36 -0500

I am using:
icpc (ICC) 11.0 20090131
Copyright (C) 1985-2009 Intel Corporation.  All rights reserved.

Try compiling this with your version of icpc:
test.cc:
class A {};

template <class X, class T> void method (double u, T v);

template <class X> void method (double u, long v);

int main (){
  double u(0); long v(0);
  method<A> (u, v);
}

using icpc -c test.cc

Here is what I get:
address@hidden ~]# icpc -c test,cc
icpc: error #10104: unable to open 'test,cc'
address@hidden ~]# icpc -c test.cc
test.cc(9): error: more than one instance of overloaded function "method" matches the argument list:
            function template "void method<X,T>(double, T)"
            function template "void method<X>(double, long)"
            argument types are: (double, long)
    method<A> (u, v);
    ^

compilation aborted for test.cc (code 2)


If you can compile that with icpc, then I'll agree that my compiler is funky!  I pulled that example oddly enough from someone that you helped in February:
http://permalink.gmane.org/gmane.comp.gnu.octave.maintainers/17942



> Date: Fri, 20 Aug 2010 21:27:47 +0200
> Subject: Re: Compiling Octave 3.2.3 with icpc 10.1 fails: more than one instance of overloaded function "octave_int_cmp_op::mop"
> From: address@hidden
> To: address@hidden
> CC: address@hidden
>
> On Fri, Aug 20, 2010 at 3:43 PM, RUSS BRENNAN <address@hidden> wrote:
> > Ok I looked into this a bit more and I think I understand the problem.
> > Around line 57 of intNDArray.cc,  we have
> >
> > template <class T>
> > bool
> > intNDArray<T>::any_element_not_one_or_zero (void) const {
> >   octave_idx_type nel = this->nelem ();
> >   for (octave_idx_type i = 0; i < nel; i++)
> >     {
> >       T val = this->elem (i);
> >       if (val != 0.0 && val != 1.0)
> >         return true;
> >     }
> >   return false;
> > }
> >
> > While the declaration of the != operator matches:
> >
> >             function template "bool octave_int_cmp_op::mop<xop,T>(T,
> > double)"
> >             function template "bool
> > octave_int_cmp_op::mop<xop>(int64_t={long long}, double)"
> >
> > Which means that if in the case that T=int64_t, the two declarations are the
> > same, which would obviously cause some compiler issues.
>
> No, the compiler should resolve this, because the second overload is
> more specialized. You need to read the C++ standard carefully to
> understand. This has been seen before with gcc 3, see
>
> http://octave.1599824.n4.nabble.com/Cast-ambiguity-compilation-error-td1653304.html#a1653307
>
> I'm very surprised that your Intel C++ behaves differently from mine.
> Forgive me the stupid question, but are you sure you properly upgraded
> and are really calling 11.0 (try icpc --version)?
>
> As another desperate attempt, you may try the development sources.
>
> --
> RNDr. Jaroslav Hajek, PhD
> computing expert & GNU Octave developer
> Aeronautical Research and Test Institute (VZLU)
> Prague, Czech Republic
> url: www.highegg.matfyz.cz

reply via email to

[Prev in Thread] Current Thread [Next in Thread]