CGAL / cgal

The public CGAL repository, see the README below
https://github.com/CGAL/cgal#readme
Other
4.68k stars 1.35k forks source link

Compilation failure of CGAL::cross_product on Windows MSVC #8140

Closed efifogel closed 1 month ago

efifogel commented 2 months ago

Issue Details

The simple program below fails to compile under Windows using MSVC. It does compile with gcc (Ubuntu). Below you can find the relevant stripped error messages. If you remove the overload of CGAL::cross_product() in DirectionH3.h, the error goes away. Andreas witness the error, and suggested to completely remove the overload. (The testsuite passes without it.) In case you wonder, this breaks my Python bindings on Windows...

C:...\cgal\Homogeneous_kernel\include\CGAL\Homogeneous\DirectionH3.h(38,35): error C2062: type 'unknown-type' unexpected C:...\cgal\Homogeneous_kernel\include\CGAL\Homogeneous\DirectionH3.h(38,58): error C2238: unexpected token(s) preceding ';' C:...\cgal\Homogeneous_kernel\include\CGAL\Homogeneous\DirectionH3.h(40,10): error C3646: 'base': unknown override specifier

Source Code

#include <CGAL/Exact_predicates_exact_constructions_kernel.h>

int main() { // For testing, we just print the combinations of types
  using Kernel = CGAL::Exact_predicates_exact_constructions_kernel;
  using Vec_3 = Kernel::Vector_3;
  using Cp_fnc3 = Vec_3(*)(const Vec_3&, const Vec_3&);

  Cp_fnc3 f = static_cast<Cp_fnc3>(&CGAL::cross_product<Kernel>);
  Vec_3 v1, v2;
  Vec_3 v = f(v1, v2);
  return 0;
}

Environment

afabri commented 2 months ago

@lrineau can we look into this on Monday. I was able to reproduce it at the CGAL Developer Meeting. We can remove the overload as it is not documented, but it would be better to understand what is going on, as there may be similar situations where overloads are justified.

mglisse commented 2 months ago

DirectionH3.h includes Handle_for.h but uses Handle, that's suspicious, although it is far from the only file that does that.

lrineau commented 2 months ago

@lrineau can we look into this on Monday. I was able to reproduce it at the CGAL Developer Meeting. We can remove the overload as it is not documented, but it would be better to understand what is going on, as there may be similar situations where overloads are justified.

@afabri One week later, still on our TODO list. We should put something in the agenda.