bugGNU Octave - Bugs: bug #47416, call of overloaded...

 
 

bug #47416: call of overloaded 'octave_value(Array<int>&)' is ambiguous

Submitter:  Alexander Barth <abarth>
Submitted:  Tue 15 Mar 2016 10:00:12 AM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Build Failure
Status:  Wont Fix Assigned to:  None
Originator Name:  Alexander Barth Open/Closed:  * Closed
Release:  * 4.0.1 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 03 Apr 2016 07:27:45 PM UTC, comment #12: 

I think sized int types are always better, and are more consistent with the way integers are used throughout Octave already.

If more constructors are added, what type of octave_value should the following produce?


Array<int32_t> x (dim_vector (1, 1));
x(0) = 42;
octave_value ov (x);


Right now, it matches the Array<octave_idx_type> and converts into an octave_matrix (a double-valued array).

I'm in favor of sized int types, but I think adding more constructors may end up adding confusion or breakage.

Users should use int32NDArray if that's what they meant to return.

Mike Miller <mtmiller>
Group Member
Fri 01 Apr 2016 10:23:51 PM UTC, comment #11: 

By "and that's it", I meant those would be the only constructors for integer types.  The other constructors would, of course, remain.

John W. Eaton <jwe>
Group administrator
Fri 01 Apr 2016 10:13:06 PM UTC, comment #10: 

Should we change the Array<T> constructors so that we provide constructors for T = {u,}int{8,16,32,64}_t and that's it?

If so, then we should not have any duplicate constructors because of some typedef.

However, what should happen for these constructors?  Should they create integer octave_values?  That would be OK with me, but then we might have to be more careful when we actually do want to create double precision octave_value objects from integers.  I think we are fairly careful about that now, but I'm not sure every case is handled correctly.

We already have constructors for T = octave_{u,}int{8,16,32,64}, but not for the bare C types.

Should we deprecate the value extractors that use C names like int_value, short_value, long_value, etc.?

Is it a good idea to always use sized int types?  Then at least you know what range of values you can expect.

John W. Eaton <jwe>
Group administrator
Tue 29 Mar 2016 04:35:33 AM UTC, comment #9: 

Is there a way to give a clearer error than the current one?  (I don't know much about compiler pragmas and such.)  The current one will will still be unclear to most users, but I agree that no fix to the actual behaviour seems justified.

Lachlan Andrew <lachlan>
Mon 28 Mar 2016 10:13:34 PM UTC, comment #8: 

I want to say this is invalid and should be closed as won't fix, but leaving open for now for other opinions.

There actually is no constructor for octave_value(const Array<int>&), there is only a constructor that takes an Array<octave_idx_type>. If octave_idx_type is not exactly "int", then it fails to construct and shows the full list of other constructors that one Array<> type may be converted (via copying) into another Array<> type.

There are valid constructors for all of the sized integer types that Octave uses, so those should be used instead, or octave_idx_type if the values being returned are actually indices into an Octave array.

Mike Miller <mtmiller>
Group Member
Mon 28 Mar 2016 09:45:32 PM UTC, comment #7: 

Ok, I can now confirm this with a 64-bit-indexing build of Octave on Debian also.

Mike Miller <mtmiller>
Group Member
Sun 27 Mar 2016 12:28:26 PM UTC, comment #6: 

When running mkoctfile helloworld_con.cc, with source file content of:


#include <octave/oct.h>

DEFUN_DLD (helloworld_con, args, nargout,
 "Hello World Help String")
 {
 int nargin = args.length ();


Array<int> data = Array<int>(dim_vector(1,3));
 data(0) = 0;
 data(1) = 1;
 data(2) = 2;


   return octave_value(data);
 }


output:

>> mkoctfile helloworld_con.cc
helloworld_con.cc: In function 'octave_value_list Fhelloworld_con(const octave_value_list&, int)':
helloworld_con.cc:17:27: error: call of overloaded 'octave_value(Array<int>&)' is ambiguous
   return octave_value(data); // same error
                           ^
helloworld_con.cc:17:27: note: candidates are:
In file included from C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/oct-obj.h:33:0,
                 from C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov-fcn.h:31,
                 from C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov-builtin.h:28,
                 from C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/defun-int.h:28,
                 from C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/defun-dld.h:30,
                 from C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/oct.h:36,
                 from helloworld_con.cc:1:
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:286:3: note: octave_value::octave_value(const Array<std::basic_s
tring<char> >&)
   octave_value (const Array<std::string>& cellstr);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:284:3: note: octave_value::octave_value(const Array<long long in
t>&, bool, bool)
   octave_value (const Array<octave_idx_type>& inda,
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:283:3: note: octave_value::octave_value(const Array<octave_int<l
ong long unsigned int> >&)
   octave_value (const Array<octave_uint64>& inda);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:282:3: note: octave_value::octave_value(const uint64NDArray&)
   octave_value (const uint64NDArray& inda);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:281:3: note: octave_value::octave_value(const Array<octave_int<u
nsigned int> >&)
   octave_value (const Array<octave_uint32>& inda);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:280:3: note: octave_value::octave_value(const uint32NDArray&)
   octave_value (const uint32NDArray& inda);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:279:3: note: octave_value::octave_value(const Array<octave_int<s
hort unsigned int> >&)
   octave_value (const Array<octave_uint16>& inda);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:278:3: note: octave_value::octave_value(const uint16NDArray&)
   octave_value (const uint16NDArray& inda);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:277:3: note: octave_value::octave_value(const Array<octave_int<u
nsigned char> >&)
   octave_value (const Array<octave_uint8>& inda);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:276:3: note: octave_value::octave_value(const uint8NDArray&)
   octave_value (const uint8NDArray& inda);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:275:3: note: octave_value::octave_value(const Array<octave_int<l
ong long int> >&)
   octave_value (const Array<octave_int64>& inda);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:274:3: note: octave_value::octave_value(const int64NDArray&)
   octave_value (const int64NDArray& inda);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:273:3: note: octave_value::octave_value(const Array<octave_int<i
nt> >&)
   octave_value (const Array<octave_int32>& inda);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:272:3: note: octave_value::octave_value(const int32NDArray&)
   octave_value (const int32NDArray& inda);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:271:3: note: octave_value::octave_value(const Array<octave_int<s
hort int> >&)
   octave_value (const Array<octave_int16>& inda);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:270:3: note: octave_value::octave_value(const int16NDArray&)
   octave_value (const int16NDArray& inda);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:269:3: note: octave_value::octave_value(const Array<octave_int<s
igned char> >&)
   octave_value (const Array<octave_int8>& inda);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:268:3: note: octave_value::octave_value(const int8NDArray&)
   octave_value (const int8NDArray& inda);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:267:3: note: octave_value::octave_value(const octave_uint64&)
   octave_value (const octave_uint64& i);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:266:3: note: octave_value::octave_value(const octave_uint32&)
   octave_value (const octave_uint32& i);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:265:3: note: octave_value::octave_value(const octave_uint16&)
   octave_value (const octave_uint16& i);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:264:3: note: octave_value::octave_value(const octave_uint8&)
   octave_value (const octave_uint8& i);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:263:3: note: octave_value::octave_value(const octave_int64&)
   octave_value (const octave_int64& i);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:262:3: note: octave_value::octave_value(const octave_int32&)
   octave_value (const octave_int32& i);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:261:3: note: octave_value::octave_value(const octave_int16&)
   octave_value (const octave_int16& i);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:260:3: note: octave_value::octave_value(const octave_int8&)
   octave_value (const octave_int8& i);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:245:3: note: octave_value::octave_value(const Array<char>&, char
)
   octave_value (const Array<char>& chnda, char type = '\'');
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:238:3: note: octave_value::octave_value(const Array<bool>&)
   octave_value (const Array<bool>& bnda);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:227:3: note: octave_value::octave_value(const Array<std::complex
<float> >&)
   octave_value (const Array<FloatComplex>& m);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:226:3: note: octave_value::octave_value(const Array<std::complex
<double> >&)
   octave_value (const Array<Complex>& m);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:225:3: note: octave_value::octave_value(const FloatComplexNDArra
y&)
   octave_value (const FloatComplexNDArray& cnda);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:224:3: note: octave_value::octave_value(const ComplexNDArray&)
   octave_value (const ComplexNDArray& cnda);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:222:3: note: octave_value::octave_value(const FloatComplexMatrix
&, const MatrixType&)
   octave_value (const FloatComplexMatrix& m,
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:221:3: note: octave_value::octave_value(const ComplexMatrix&, co
nst MatrixType&)
   octave_value (const ComplexMatrix& m, const MatrixType& t = MatrixType ());
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:208:3: note: octave_value::octave_value(const Array<float>&)
   octave_value (const Array<float>& m);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:207:3: note: octave_value::octave_value(const Array<double>&)
   octave_value (const Array<double>& m);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:206:3: note: octave_value::octave_value(const FloatNDArray&)
   octave_value (const FloatNDArray& nda);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:205:3: note: octave_value::octave_value(const NDArray&)
   octave_value (const NDArray& nda);
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:204:3: note: octave_value::octave_value(const FloatMatrix&, cons
t MatrixType&)
   octave_value (const FloatMatrix& m, const MatrixType& t = MatrixType ());
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:203:3: note: octave_value::octave_value(const Matrix&, const Mat
rixType&)
   octave_value (const Matrix& m, const MatrixType& t = MatrixType ());
   ^
C:\Octave\Octave-4.0.1\include\octave-4.0.1\octave\../octave/ov.h:201:3: note: octave_value::octave_value(const Array<octave_value
>&, bool)
   octave_value (const Array<octave_value>& a, bool is_cs_list = false);
   ^
warning: mkoctfile exited with failure status
warning: called from
    mkoctfile at line 171 column 5
>>


John Donoghue <lostbard>
Group Member
Fri 25 Mar 2016 03:41:35 PM UTC, comment #5: 

I'm doing a rebuild for win64, enable-64 currently, so when it is done, I will attach the whole list.

John Donoghue <lostbard>
Group Member
Fri 25 Mar 2016 03:38:21 PM UTC, comment #4: 

The unanswered question for me still is which octave_value constructors are considered ambiguous under Windows with --enable-64? I don't have a 64-bit-index build on Debian at the moment to see if this is a problem there also. Can someone with a Windows build show the whole error or list which sets of constructors are considered ambiguous?

Mike Miller <mtmiller>
Group Member
Fri 25 Mar 2016 03:30:01 PM UTC, comment #3: 

The code is a simplified example of a function in octave forge netcdf package.

As such, would normally be compiled via mkoctfile from within pkg install.


If the array is changed from Array<int> to Array<double>, it does not have the error.

John Donoghue <lostbard>
Group Member
Fri 25 Mar 2016 03:41:14 AM UTC, comment #2: 

Could you please be more specific?  The code is C++ code, not Octave code.  How are you trying to compile it?  Is it with mkoctfile?

Lachlan Andrew <lachlan>
Tue 15 Mar 2016 10:22:46 AM UTC, comment #1: 

For more info, this is only when octave was configured with --enable-64


John Donoghue <lostbard>
Group Member
Tue 15 Mar 2016 10:00:12 AM UTC, original submission:  


In bug #46060, I have been told that the code below does not work on win32 and win64 versions of octave 4.0.1-rc3, while it works fine under Linux.

#include <octave/oct.h>

DEFUN_DLD (helloworld_con, args, nargout,
           "Hello World Help String")
{
  int nargin = args.length ();

  Array<int> data = Array<int>(dim_vector(1,3));;
  data(0) = 0;
  data(1) = 1;
  data(2) = 2;
 
  return octave_value(int32NDArray(data));
  // return octave_value(data); // same error
}

The produced error message is:
error: call of overloaded 'octave_value(Array<int>&)' is ambiguous

I don't see why this function call should be ambiguous and since it happens only on Windows I suspect an issue in octave.

I don't use windows so I cannot reproduce this myself, but maybe John Donoghue is available to provide more information if necessary.


Alexander Barth <abarth>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #36647:  helloworld_con.cc added by abarth (282B - text/x-c++src)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Updated the item)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by lachlan (Posted a comment)
  • -email is unavailable- added by lostbard (Posted a comment)
  • -email is unavailable- added by abarth (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-11-23 mtmiller Open/ClosedOpen Closed
    2016-08-24 rik5 Severity4 - Important 3 - Normal
    2016-07-01 rik5 Severity3 - Normal 4 - Important
    2016-03-28 mtmiller StatusConfirmed Wont Fix
    2016-03-28 mtmiller StatusNeed Info Confirmed
        Operating SystemMicrosoft Windows Any
    2016-03-25 mtmiller Release4.0.1-rc1 4.0.1
    2016-03-25 mtmiller StatusNone Need Info
    2016-03-15 abarth Attached File- Added helloworld_con.cc, #36647

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code