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

CGAL Bug or GCC6 Compiler Bug ? #8759

Open
afabri opened this issue Feb 28, 2025 · 6 comments
Open

CGAL Bug or GCC6 Compiler Bug ? #8759

afabri opened this issue Feb 28, 2025 · 6 comments

Comments

@afabri
Copy link
Member

afabri commented Feb 28, 2025

Issue Details

Error message in a master branch testsuite

Environment

  • Operating system (Windows/Mac/Linux, 32/64 bits):
  • Compiler:
  • Release or debug mode:
  • Specific flags used (if any):
  • CGAL version: CGAL-6.1-I-95, that is github master branch
  • Boost version:
  • Other libraries versions if used (Eigen, TBB, etc.):
@afabri
Copy link
Member Author

afabri commented Mar 4, 2025

What happens is that this overload of convex_hull_3() should be picked, but it isn't,
Instead this overload is picked.

@lrineau
Copy link
Member

lrineau commented Mar 10, 2025

That is a CGAL bug. The call is:

  typedef  std::vector<Point_3> Vertices;
  typedef std::vector<std::array<int,3> > Faces;

  Vertices vertices;
  Faces faces;

  std::vector<Point_3> points;
  // [...]
  CGAL::convex_hull_3(points.begin(), points.end(), vertices, faces);

There are two possible matches:

  • template <class InputIterator, class PolygonMesh, class Traits>
    void convex_hull_3(InputIterator first, InputIterator beyond,
    PolygonMesh& polyhedron,
    const Traits& traits)
  • template <class InputIterator, class PointRange, class TriangleRange>
    void convex_hull_3(InputIterator first, InputIterator beyond,
    PointRange& vertices,
    TriangleRange& faces,
    std::enable_if_t<CGAL::is_iterator<InputIterator>::value>* = 0,
    std::enable_if_t<boost::has_range_iterator<PointRange>::value>* = 0,
    std::enable_if_t<boost::has_range_iterator<TriangleRange>::value>* = 0)

And none of them is rejected by the std::enable_if_t.

@afabri
Copy link
Member Author

afabri commented Mar 10, 2025

Well, all other compilers succeed. Do you have an idea for a fix @lrineau ?

@sloriot
Copy link
Member

sloriot commented Mar 11, 2025

I tried to reproduce it with gcc master but it could not. I would suggest to remove the traits and introduce a named parameter (the PolygonMesh parameter is anyway missing the VPM parameter).

@afabri
Copy link
Member Author

afabri commented Mar 13, 2025

How can it make a difference when you replace \tparam Traits with \tpram NamedParameters?

@MaelRL
Copy link
Member

MaelRL commented Mar 16, 2025

How can it make a difference when you replace \tparam Traits with \tpram NamedParameters?

You can use the macros CGAL_NP_TEMPLATE_PARAMETERS and CGAL_NP_CLASS (https://github.com/CGAL/cgal/blob/master/STL_Extension/include/CGAL/Named_function_parameters.h) instead of a generic template parameter called NamedParameters to avoid ambiguity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants