octave-maintainers
[Top][All Lists]
Advanced

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

Cast ambiguity compilation error


From: Daniel J Sebald
Subject: Cast ambiguity compilation error
Date: Sun, 18 Jan 2009 14:56:12 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020

I've gotten Mercurial working on my FC3 machine (hoorah!).  Python path 
problem...

Compiling the latest source on this older system has uncovered one small syntax 
problem, I believe.  Or I have some outdated compiler, std library headers, or 
something.

The issue is the abiguity of '!' operator overloaded in oct-inttypes.h.  An 
example string of errors is below.  There are only a few spots where these 
errors are occuring.  (Note that the errors are happening when building 
liboctave, not the src.)  I fixed one instance with a kludge old-style case:


diff -Pur octave/liboctave/intNDArray.cc octave-mod/liboctave/intNDArray.cc
--- octave/liboctave/intNDArray.cc      2009-01-18 13:45:08.000000000 -0600
+++ octave-mod/liboctave/intNDArray.cc  2009-01-18 13:53:19.000000000 -0600
@@ -53,7 +53,7 @@
    {
      T val = this->elem (i);

-      if (((double)val) != 0.0 && ((double)val) != 1.0)
+      if (val != 0.0 && val != 1.0)
        return true;
    }


Things then compiled along until hitting another instance:

oct-inttypes.h: In function `bool operator!=(const double&, const 
octave_int<T>&) [with T = int64_t]':
mx-s-i64nda.cc:11:   instantiated from here
oct-inttypes.h:1059: error: call of overloaded `mop(const double&, int64_t)' is 
ambiguous
oct-inttypes.h:193: note: candidates are: static bool octave_int_cmp_op::mop(T, 
double) [with xop = octave_int_cmp_op::ne, T = double]
oct-inttypes.h:198: note:                 static bool 
octave_int_cmp_op::mop(double, T) [with xop = octave_int_cmp_op::ne, T = long 
long int]
oct-inttypes.h:211: note:                 static bool 
octave_int_cmp_op::mop(double, uint64_t) [with xop = octave_int_cmp_op::ne]
oct-inttypes.h:212: note:                 static bool 
octave_int_cmp_op::mop(double, int64_t) [with xop = octave_int_cmp_op::ne]
oct-inttypes.h:213: note:                 static bool 
octave_int_cmp_op::mop(int64_t, double) [with xop = octave_int_cmp_op::ne]
oct-inttypes.h:214: note:                 static bool 
octave_int_cmp_op::mop(uint64_t, double) [with xop = octave_int_cmp_op::ne]

which is much more difficult for me to kludge because it is embedded in some 
definition strings.

The compilation commands are pretty much the same and the one thing different 
doesn't seem to matter when I remove -fPIC:

OLDER VERSION THAT COMPILES
g++ -c -I/usr/include/pcre -I. -I.. -I../liboctave -I../src -I../libcruft/misc 
-DHAVE_CONFIG_H -mieee-fp -Wall -W -Wshadow -Wold-style-cast -g -O2 
mx-s-i64nda.cc -o mx-s-i64nda.o

NEWER VERSION THAT DOESN'T COMPILE
g++ -c -I/usr/include/pcre -fPIC -I. -I.. -I../liboctave -I../src 
-I../libcruft/misc  -DHAVE_CONFIG_H -mieee-fp -Wall -W -Wshadow 
-Wold-style-cast -g -O2 mx-s-i64nda.cc -o pic/mx-s-i64nda.o

Anyone with general variable type T experience have a guess as to where to 
look?  Command line switch?  Newer compiler?  The above files have been 
unaltered for years, yet last year I was compiling the CVS version with no 
problems.

Thanks,

Dan


reply via email to

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