Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add const version of Integer::operator=() #161

Closed
wants to merge 1 commit into from
Closed

Add const version of Integer::operator=() #161

wants to merge 1 commit into from

Conversation

arrowd
Copy link

@arrowd arrowd commented Jun 20, 2020

When building sage with latest releases of linbox and givaro I get following error:

[sagelib-9.1] In file included from build/cythonized/sage/matrix/matrix_modn_sparse.cpp:4089:
[sagelib-9.1] In file included from /usr/local/include/linbox/solutions/charpoly.h:34:
[sagelib-9.1] In file included from /usr/local/include/linbox/algorithms/bbcharpoly.h:46:
[sagelib-9.1] In file included from /usr/local/include/linbox/solutions/det.h:608:
[sagelib-9.1] /usr/local/include/linbox/algorithms/det-rational.h:95:39: error: no viable overloaded '='
[sagelib-9.1]                 void setDiv (const Integer& d) {div = d;}
[sagelib-9.1]                                                 ~~~ ^ ~
[sagelib-9.1] /usr/local/include/gmp++/gmp++_int.h:236:34: note: candidate function not viable: 'this' argument has type 'const LinBox::Integer' (aka 'const Givaro::Integer'), but method is not marked const
[sagelib-9.1]         giv_all_inlined Integer& operator = (const Integer& n);
[sagelib-9.1]                                  ^

This PR fixes the error, but I'm not sure it is a correct solution.

@jgdumas
Copy link
Member

jgdumas commented Jun 25, 2020

Hum, I do not think it is a good idea to const cast in Givaro.
The problem comes from det-rational.h
There is an inconsistency between mul/div being "const Integer&", and having modifier method setDiv/setMul.

I would suggest to LinBox to instead make a copy and declare mul/div to be just "Integer".

@jgdumas jgdumas closed this Jun 25, 2020
@arrowd
Copy link
Author

arrowd commented Jun 25, 2020

Sorry, I didn't get it. Should I provide a patch, or you'll fix this yourself?

@jgdumas
Copy link
Member

jgdumas commented Jun 25, 2020

Well I cannot reproduce the issue you mention. So can you give more details on compilers, flags, etc. ?
Otherwise can you try what I propose on your install, if it works I can test it further and propose a PR ...

@arrowd
Copy link
Author

arrowd commented Jun 25, 2020

I'm compiling on FreeBSD 13-CURRENT, which uses Clang 10 as compiler. And that's the culprit I suspect, because the error doesn't appear on FreeBSD 12.1, which uses older clang.

Can you try building givaro with Clang 10?

@jgdumas
Copy link
Member

jgdumas commented Jun 26, 2020

OK I could reproduce the issue. Thank you.
This is now solved in LinBox PR256 : linbox-team/linbox#256

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants