Welcome! Log In Create A New Profile

Advanced

Compiling error in 2.0r0

Posted by PavelPavel  
Compiling error in 2.0r0
March 06, 2018 10:16AM
Hi all,

I've tried to port my program that used v1.5r1 to v2.0r0 (and also to a new version of gcc), and I got the following error while compiling:

Language: GNU make
[exec] In file included from /home/pavel/ISR/ISR3D-endothelium/kernel/flow3d/palabos-v2.0r0/src/gridRefinement/octreeGridGenerator.h:33:0, [exec] from /home/pavel/ISR/ISR3D-endothelium/kernel/flow3d/palabos-v2.0r0/src/gridRefinement/boxLogic3D.h:32, [exec] from /home/pavel/ISR/ISR3D-endothelium/kernel/flow3d/palabos-v2.0r0/src/gridRefinement/couplingInterfaceGenerator3D.h:40, [exec] from /home/pavel/ISR/ISR3D-endothelium/kernel/flow3d/palabos-v2.0r0/src/gridRefinement/gridRefinementUtil3D.h:36, [exec] from /home/pavel/ISR/ISR3D-endothelium/kernel/flow3d/palabos-v2.0r0/src/gridRefinement/headers3D.h:25, [exec] from /home/pavel/ISR/ISR3D-endothelium/kernel/flow3d/palabos-v2.0r0/src/palabos3D.h:44, [exec] from flow3d.h:10, [exec] from rectangularChannel3D.cpp:12: [exec] /home/pavel/ISR/ISR3D-endothelium/kernel/flow3d/palabos-v2.0r0/src/multiBlock/multiDataField3D.hh: In instantiation of ‘void plb::MultiNTensorField3D<T>::allocateFields() [with T = bool]: [exec] /home/pavel/ISR/ISR3D-endothelium/kernel/flow3d/palabos-v2.0r0/src/multiBlock/multiDataField3D.hh:687:19: required from ‘plb::MultiNTensorField3D<T>::MultiNTensorField3D(const plb::MultiNTensorField3D<T>&) [with T = bool][exec] /home/pavel/ISR/ISR3D-endothelium/kernel/flow3d/palabos-v2.0r0/src/multiBlock/multiDataField3D.hh:767:12: required from ‘plb::MultiNTensorField3D<T>* plb::MultiNTensorField3D<T>::clone() const [with T = bool][exec] rectangularChannel3D.cpp:457:1: required from here [exec] /home/pavel/ISR/ISR3D-endothelium/kernel/flow3d/palabos-v2.0r0/src/multiBlock/multiDataField3D.hh:807:20: error: taking address of temporary [-fpermissive] [exec] allocateFields(&iniVal[0]); [exec] ^~~~~~~~ [exec] /home/pavel/ISR/ISR3D-endothelium/kernel/flow3d/palabos-v2.0r0/src/multiBlock/multiDataField3D.hh:807:19: error: no matching function for call to ‘plb::MultiNTensorField3D<bool>::allocateFields(std::vector<bool>::reference*)[exec] allocateFields(&iniVal[0]); [exec] ~~~~~~~~~~~~~~^~~~~~~~~~~~ [exec] /home/pavel/ISR/ISR3D-endothelium/kernel/flow3d/palabos-v2.0r0/src/multiBlock/multiDataField3D.hh:804:6: note: candidate: void plb::MultiNTensorField3D<T>::allocateFields() [with T = bool] [exec] void MultiNTensorField3D<T>::allocateFields() { [exec] ^~~~~~~~~~~~~~~~~~~~~~ [exec] /home/pavel/ISR/ISR3D-endothelium/kernel/flow3d/palabos-v2.0r0/src/multiBlock/multiDataField3D.hh:804:6: note: candidate expects 0 arguments, 1 provided [exec] /home/pavel/ISR/ISR3D-endothelium/kernel/flow3d/palabos-v2.0r0/src/multiBlock/multiDataField3D.hh:811:6: note: candidate: void plb::MultiNTensorField3D<T>::allocateFields(const T*) [with T = bool] [exec] void MultiNTensorField3D<T>::allocateFields(T const* iniVal) [exec] ^~~~~~~~~~~~~~~~~~~~~~ [exec] /home/pavel/ISR/ISR3D-endothelium/kernel/flow3d/palabos-v2.0r0/src/multiBlock/multiDataField3D.hh:811:6: note: no known conversion for argument 1 from ‘std::vector<bool>::reference* {aka std::_Bit_reference*}’ to ‘const bool*

I'm running Ubuntu Artful Aardvark, gcc 7.2.0 and compiling to c++11 standard.

The benchmark program (cavity3d) builds fine for me. Apparently, that's because these templates only result in an error when they are instantiated with bool, and this doesn't happen in the benchmark.


UPD: I fixed it by specializing the template for bool. Some quick testing shows that it doesn't break anything obvious, at least in my usecase.

Language: C++
template<> void MultiNTensorField3D<bool>::allocateFields() { std::vector<char> iniVal(this->getNdim()); std::fill(iniVal.begin(), iniVal.end(), bool()); allocateFields((bool *) &iniVal[0]); }



Edited 1 time(s). Last edit at 03/06/2018 11:03AM by Pavel.
Sorry, you do not have permission to post/reply in this forum.