slazav / mapsoft2

Programs for map handling, based on mapsoft2-libs
https://slazav.github.io/mapsoft2/
GNU General Public License v3.0
6 stars 1 forks source link

Build with clang failed #68

Closed sikmir closed 3 months ago

sikmir commented 3 months ago
mapsoft2> In file included from ./io.h:7:
mapsoft2> ./image_r.h:52:41: error: cannot initialize return object of type 'unsigned char *' with an rvalue of type 'element_type *' (aka 'unsigned char (*)[]')
mapsoft2>     unsigned char *data() const {return data_.get();}
mapsoft2>                                         ^~~~~~~~~~~
mapsoft2> ./image_r.h:88:17: error: no matching conversion for functional-style cast from 'unsigned char *' to 'std::shared_ptr<unsigned char[]>'
mapsoft2>         data_ = std::shared_ptr<unsigned char[]>(new unsigned char[dsize()]);
mapsoft2>                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
slazav commented 3 months ago

Can't reproduce with clang++18.1.8. I noticed that shared_ptr with array type is marked as C++17 feature. Does CXX=clang++ CXXFLAGS=-std=gnu++17 make works?

slazav commented 3 months ago

please also try recent commit in mapsoft2-libs

sikmir commented 3 months ago

Can't reproduce with clang++18.1.8. I noticed that shared_ptr with array type is marked as C++17 feature. Does CXX=clang++ CXXFLAGS=-std=gnu++17 make works?

clang 16.0.6 on macOS. Yes, -std=c++17 solves problem.

sikmir commented 3 months ago

please also try recent commit in mapsoft2-libs

Yes, it works as well (without -std=c++17)