Skip to content

[BUG] island.hpp:226:16: error: cannot initialize return object of type 'void *' #584

@jschueller

Description

@jschueller

Describe the bug

compiling the island test with clang >= 17 on linux fails with:

In file included from /tmp/pagmo2/tests/island.cpp:56:
/tmp/pagmo2/include/pagmo/island.hpp:226:16: error: cannot initialize return object of type 'void *' with an rvalue of type 'const pagmo::thread_island *'
  226 |         return &m_value;
      |                ^~~~~~~~
/tmp/pagmo2/include/pagmo/island.hpp:1057:20: note: in instantiation of member function 'pagmo::detail::isl_inner<const pagmo::thread_island>::get_ptr' requested here
 1057 |         auto isl = dynamic_cast<detail::isl_inner<T> *>(m_ptr->isl_ptr.get());
      |                    ^
/tmp/pagmo2/tests/island.cpp:536:21: note: in instantiation of function template specialization 'pagmo::island::extract<const pagmo::thread_island>' requested here
  536 |     BOOST_CHECK(isl.extract<const thread_island>() == nullptr);
      |

To Reproduce

just build master on latest ubuntu:

FROM ubuntu:noble
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get -y update && apt-get -y install cmake clang libtbb-dev libeigen3-dev git libboost-serialization-dev libboost-test-dev g++
WORKDIR /tmp
RUN git clone --depth 1 https://github.com/esa/pagmo2.git
RUN cmake -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_UNITY_BUILD=ON -DPAGMO_WITH_EIGEN3=ON -DPAGMO_BUILD_TESTS=ON -S pagmo2 -B build 
RUN cmake --build build --parallel 8
RUN ctest --test-dir build

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions