Skip to content

Compilation fails in c++20 #55

@vvkphys

Description

@vvkphys

The code does not work with C++20.

Apptainer> make
[ 0%] Built target atlas_tests
[ 0%] Built target Package_bjoern-andres-graph
[ 11%] Building CXX object GraphTest/CMakeFiles/GraphTestLib.dir/src/GraphTestAlg.cxx.o
In file included from /srv/build/_deps/bjoern-andres-graph-src/include/andres/graph/detail/graph.hxx:6,
from /srv/build/_deps/bjoern-andres-graph-src/include/andres/graph/graph.hxx:17,
from /srv/athena-graph/GraphTest/src/GraphTestAlg.cxx:4:
/srv/build/_deps/bjoern-andres-graph-src/include/andres/random-access-set.hxx: In instantiation of 'class andres::RandomAccessSet<andres::graph::Adjacency<> >':
/srv/build/_deps/bjoern-andres-graph-src/include/andres/graph/detail/graph.hxx:30:23: required from here
/srv/build/_deps/bjoern-andres-graph-src/include/andres/random-access-set.hxx:35:49: error: no type named 'const_reference' in 'class std::allocator<andres::graph::Adjacency<> >'
35 | typedef typename Allocator::const_reference const_reference;
| ^~~~~~~~~~~~~~~
/srv/build/_deps/bjoern-andres-graph-src/include/andres/graph/detail/graph.hxx:63:5: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
63 | value_type operator*() const;
| ^~~~~~~~~~
/srv/build/_deps/bjoern-andres-graph-src/include/andres/graph/detail/graph.hxx:64:5: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
64 | value_type operator[](const std::size_t j) const;
| ^~~~~~~~~~
/srv/build/_deps/bjoern-andres-graph-src/include/andres/graph/detail/graph.hxx:160:8: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
160 | inline typename IteratorHelper::value_type
| ^~~~~~~~
/srv/build/_deps/bjoern-andres-graph-src/include/andres/graph/detail/graph.hxx:171:8: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
171 | inline typename IteratorHelper::value_type
| ^~~~~~~~
make[2]: *** [GraphTest/CMakeFiles/GraphTestLib.dir/build.make:76: GraphTest/CMakeFiles/GraphTestLib.dir/src/GraphTestAlg.cxx.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:320: GraphTest/CMakeFiles/GraphTestLib.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

If you check, the type in question was removed with C++20.

https://en.cppreference.com/w/cpp/memory/allocator

Is it possible to make this code working with C++20?

Best regards,
Vadim

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions