Bug 180337 - devel/tnt: tnt_sparse_matrix_csr.h:97:3: error: no matching constructor for initialization of 'Array1D<int>'
Summary: devel/tnt: tnt_sparse_matrix_csr.h:97:3: error: no matching constructor for i...
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-06 00:50 UTC by O. Hartmann
Modified: 2014-07-14 11:26 UTC (History)
2 users (show)

See Also:


Attachments
file.diff (1.72 KB, patch)
2013-07-06 00:50 UTC, O. Hartmann
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description O. Hartmann 2013-07-06 00:50:00 UTC
Compiling software packages utilizing port math/jama with CLANG (3.2/3.3) results in the error shown below. This error seems to be well known since 2011 (see for instance http://sourceforge.net/p/pymol/bugs/100/).

[...]
In file included from ForstnerOperator.cpp:7:
In file included from /usr/local/include/tnt/jama_lu.h:4:
In file included from /usr/local/include/tnt/tnt.h:55:
/usr/local/include/tnt/tnt_sparse_matrix_csr.h:97:3: error: no matching constructor for initialization of 'Array1D<int>'
                rowptr_(M, r), colind_(nz, c), dim1_(M), dim2_(N) {}
                ^       ~~~~
/usr/local/include/tnt/tnt_array1d.h:63:11: note: candidate constructor not viable: no known conversion from 'const int *' to 'const int' for 2nd argument; dereference the argument with *
                 Array1D(int n, const T &a);
                 ^
/usr/local/include/tnt/tnt_array1d.h:64:11: note: candidate constructor not viable: 2nd argument ('const int *') would lose const qualifier
                 Array1D(int n,  T *a);
                 ^
/usr/local/include/tnt/tnt_array1d.h:61:11: note: candidate constructor not viable: requires 0 arguments, but 2 were provided
                 Array1D();
                 ^
/usr/local/include/tnt/tnt_array1d.h:62:11: note: candidate constructor not viable: requires single argument 'n', but 2 arguments were provided
        explicit Array1D(int n);
                 ^
/usr/local/include/tnt/tnt_array1d.h:65:14: note: candidate constructor not viable: requires single argument 'A', but 2 arguments were provided
    inline   Array1D(const Array1D &A);
             ^
In file included from ForstnerOperator.cpp:7:
In file included from /usr/local/include/tnt/jama_lu.h:4:
In file included from /usr/local/include/tnt/tnt.h:55:
/usr/local/include/tnt/tnt_sparse_matrix_csr.h:97:18: error: no matching constructor for initialization of 'Array1D<int>'
                rowptr_(M, r), colind_(nz, c), dim1_(M), dim2_(N) {}
                               ^       ~~~~~
/usr/local/include/tnt/tnt_array1d.h:63:11: note: candidate constructor not viable: no known conversion from 'const int *' to 'const int' for 2nd argument; dereference the argument with *
                 Array1D(int n, const T &a);
                 ^
/usr/local/include/tnt/tnt_array1d.h:64:11: note: candidate constructor not viable: 2nd argument ('const int *') would lose const qualifier
                 Array1D(int n,  T *a);
                 ^
/usr/local/include/tnt/tnt_array1d.h:61:11: note: candidate constructor not viable: requires 0 arguments, but 2 were provided
                 Array1D();
                 ^
/usr/local/include/tnt/tnt_array1d.h:62:11: note: candidate constructor not viable: requires single argument 'n', but 2 arguments were provided
        explicit Array1D(int n);
                 ^
/usr/local/include/tnt/tnt_array1d.h:65:14: note: candidate constructor not viable: requires single argument 'A', but 2 arguments were provided
    inline   Array1D(const Array1D &A);
             ^

Fix: As mentioned and suggested at http://sourceforge.net/p/pymol/bugs/100/, change file tnt/tnt_sparse_matrix_csr.h according

--- tnt/tnt_sparse_matrix_csr.h.sav 2011-05-11 22:24:31.000000000 -0400
+++ tnt/tnt_sparse_matrix_csr.h 2011-05-11 22:29:32.000000000 -0400
@@ -49,8 +49,8 @@

private:
Array1D<T> val_; // data values (nz_ elements)
- Array1D<int> rowptr_; // row_ptr (dim_[0]+1 elements)
- Array1D<int> colind_; // col_ind (nz_ elements)
+ Array1D<T> rowptr_; // row_ptr (dim_[0]+1 elements)
+ Array1D<T> colind_; // col_ind (nz_ elements)

int dim1_; // number of rows
int dim2_; // number of cols

Find a patched version of the ports Makefile and patched file attached.

Patch attached with submission follows:
How-To-Repeat: Try compiling a client using the mentioned constructor with CLANG (I use a USGS specific planetary software package called ISIS3 which compiles well with GCC and fails with CLANG with the mentioned error).
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2013-07-06 00:50:08 UTC
Maintainer of devel/tnt,

Please note that PR ports/180337 has just been submitted.

If it contains a patch for an upgrade, an enhancement or a bug fix
you agree on, reply to this email stating that you approve the patch
and a committer will take care of it.

The full text of the PR can be found at:
    http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/180337

-- 
Edwin Groothuis via the GNATS Auto Assign Tool
edwin@FreeBSD.org
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2013-07-06 00:50:09 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 3 Erik Greenwald 2013-08-05 14:36:43 UTC
Hi, sorry for the delayed response

I'm a bit concerned that the patch removes type checking to avoid
what seems on the surface like a legitimate warning (casting "const
int" to "const int *").  Is it possible that isis3 is using TNT
incorrectly? BRL-CAD seems to use the TNT Array1D with clang without
issue...

Thanks
 -Erik
Comment 4 O. Hartmann 2013-08-06 10:09:32 UTC
On Mon, 5 Aug 2013 09:36:43 -0400
Erik Greenwald <erik@elfga.com> wrote:

> Hi, sorry for the delayed response
> 
> I'm a bit concerned that the patch removes type checking to avoid
> what seems on the surface like a legitimate warning (casting "const
> int" to "const int *").  Is it possible that isis3 is using TNT
> incorrectly? BRL-CAD seems to use the TNT Array1D with clang without
> issue...
> 
> Thanks
>  -Erik


Hello.

It's possible that ISIS3 isn't using the object the correct way. CLANG
fails on that subject, gcc 4.6 doesn't.
Comment 5 John Marino freebsd_committer freebsd_triage 2014-07-11 08:14:38 UTC
Is this PR still valid?
Comment 6 John Marino freebsd_committer freebsd_triage 2014-07-11 08:15:07 UTC
Adding Erik back to PR
Comment 7 O. Hartmann 2014-07-14 11:16:37 UTC
I think the PR can be closed.
Comment 8 John Marino freebsd_committer freebsd_triage 2014-07-14 11:26:47 UTC
Submitter indicates PR can be closed.