Closed Drvanon closed 3 years ago
For posterity: I solved this by setting the compiler to use C++11 by running export CFLAGS='-std=c++11'
in the shell that I run ./setup.py install
.
That's annoying. Can you add an issue at https://github.com/adc-connect/libtensor? Or even better: Open a PR over there to fix it. Roughly all it takes is to remove the exception declarations explcitly.
I think Issues are disabled for our libtensor fork... PR would be much appreciated! 😄 👍
Ah true ... maybe we should enable that.
I am trying to do the PR, and I think the solution is just to do a general replacement of throw (generic_exception)
to throw ()
. If I understand the comments on this correctly. Another option would be to use noexcept(false)
, but I admit to not understanding C++17 exceptions well enough to be authoritative on this.
Basically C++17 deprecates throw declarations, so just remove the throw( ... )
attributes completely.
Sweet, I will than throw the following regex over the code: throw \((.*?)\)
. My plan is to replace all that with an empty string. Side note: turning on C++17 compliance on your project in the CMakeLists.txt file generators a frightening amount of warnings, most of which can be removed by taking away the register keyword from for loops. I don't know if you would like me to do that too, but if so that is no problem.
Probably we should stick to C++11/C++14 as CMAKE_CXX_STANDARD
for the time being, @mfherbst? I just checked other packages, Psi4 still at C++14, so probably we should not bump this... could also make conda package compatibility more difficult than needed.
register is deprecated too and can be removed. I don't mind in hard-enforcing C++14 for adcc. But the work of @Drvanon does not require C++17. Rather it allows C++17 (and leads to a requiremend for C++11, which is fair).
But the work of @Drvanon does not require C++17.
I know 😄 But he was asking whether to do this or not... Long story short: leave all C++ standards as is 😆
ah yes, definitely :smile: ... sorry 'bout the confusion.
Sweet, I will than throw the following regex over the code:
throw \((.*?)\)
. My plan is to replace all that with an empty string.
Hmmm, just went through the changes. This does remove everywhere were throw is used (naturally), but that also implies not throwing any error, ever. Is this the intention? edit: Because there is only 10 lines, I will just look at them by hand.
No better not... What I had in mind was to only remove the throw declaration in the function definition and not the throw statements. In that sense your regex might be too wide. I have not checked. Just fix that by only committing the appropriate lines (git add -p
). I.e. remove
int test() throw (myexcept) {
...
}
but not
int test() {
throw (myexcept)
}
Since I am completely unfamiliar with the throw functionality in c++, is the const
part of the throw
in the following piece:
template<typename ListT>
void populate(ListT &list, const dimensions<k_ordera> &dima,
const dimensions<k_orderb> &dimb,
const dimensions<k_orderc> &dimc) const throw(exception);
is the const part of the throw in the following piece:
No. I'm certain that const
has nothing to do with throw
.
discussion continues in https://github.com/adc-connect/libtensor/pull/12
In the processes of trying to reinstall I encountered the error at the bottom of this file. This is a libtensorlight problem, but I could not add the issue at that repository. I will try to compile using C++11, but I think this error is worth wile investigating from the simple perspective of maintenance.