xtl icon indicating copy to clipboard operation
xtl copied to clipboard

Compiler error using C++17

Open tdegeus opened this issue 3 years ago • 5 comments

When compiling using C++17 on linux/clang I get the following compiler error:

In file included from /home/travis/build/tdegeus/GMatElastoPlasticQPot/test/Cartesian2d.cpp:3:
826In file included from /home/travis/miniconda/include/xtensor/xrandom.hpp:21:
827In file included from /home/travis/miniconda/include/xtensor/xbuilder.hpp:32:
828In file included from /home/travis/miniconda/include/xtensor/xbroadcast.hpp:23:
829In file included from /home/travis/miniconda/include/xtensor/xaccessible.hpp:14:
830In file included from /home/travis/miniconda/include/xtensor/xstrides.hpp:21:
831In file included from /home/travis/miniconda/include/xtensor/xshape.hpp:23:
832In file included from /home/travis/miniconda/include/xtensor/xstorage.hpp:23:
833In file included from /home/travis/miniconda/include/xtensor/xtensor_simd.hpp:14:
834In file included from /home/travis/miniconda/include/xtl/xdynamic_bitset.hpp:18:
835In file included from /home/travis/miniconda/include/xtl/xspan.hpp:13:
836/home/travis/miniconda/include/xtl/xspan_impl.hpp:134:19: error: no type named
837      'byte' in namespace 'std'
838using byte = std::byte;
839             ~~~~~^
840/home/travis/miniconda/include/xtl/xspan_impl.hpp:173:12: error: no member named
841      'data' in namespace 'std'
842using std::data;
843      ~~~~~^
844/home/travis/miniconda/include/xtl/xspan_impl.hpp:174:7: error: no member named
845      'size' in namespace 'std'; did you mean 'std::seed_seq::size'?
846using std::size;
847      ^~~~~

tdegeus avatar Sep 11 '20 08:09 tdegeus

This is a known bug in clang 5 (even when passing the -std=c++17 flag). Is that the version you use?

JohanMabille avatar Sep 22 '20 14:09 JohanMabille

clang 6 (on travis)

tdegeus avatar Sep 23 '20 13:09 tdegeus

If it's a compiler bug we can close it here I guess...?

tdegeus avatar Sep 23 '20 13:09 tdegeus

I thought the bug was fixed in clang6, but it looks a bit more complicated. So definitely not a bug of xtl, but we can try to fix your issue ;) Does it help if you upgrade the host compiler of travis to GCC 7? Even if compiling with clang, you may use the standard library shiped with the host compiler, and std::byte was added in GCC 7.

JohanMabille avatar Sep 23 '20 14:09 JohanMabille

GCC worked! For now I abandoned C++17 as it gave a bunch of other errors elsewhere. I didn't need it, I was just hoping that it would solve the alignment issues I was having with xtensor_fixed. But for the moment I abandoned that too for std::array (unfortunately giving a speedup in the process)

tdegeus avatar Sep 23 '20 14:09 tdegeus

Closing for now. Should be reopened if relevant

tdegeus avatar Apr 19 '23 09:04 tdegeus