Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MeshBoolean: fix GCC 14 compile error #4499

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/libslic3r/MeshBoolean.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,12 @@ template<class _Mesh> TriangleMesh cgal_to_triangle_mesh(const _Mesh &cgalmesh)
const auto &vertices = cgalmesh.vertices();
int vsize = int(vertices.size());

for (auto &vi : vertices) {
for (auto vi : vertices) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't a const reference, i.e. adding const, enough on both list traversals (to avoid value copy)?

At least that is what Gentoo Linux applies as compile patch since considerable time, see
https://gitweb.gentoo.org/repo/gentoo.git/tree/media-gfx/superslicer/files/superslicer-2.5.59.8-fix-compilation-error-gnu17.patch

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That also works, I suppose. In that case I would suggest to apply the Gentoo patch instead of this PR.

auto &v = cgalmesh.point(vi); // Don't ask...
its.vertices.emplace_back(to_vec3f(v));
}

for (auto &face : faces) {
for (auto face : faces) {
auto vtc = cgalmesh.vertices_around_face(cgalmesh.halfedge(face));

int i = 0;
Expand Down