cgal icon indicating copy to clipboard operation
cgal copied to clipboard

Compilation failure of CGAL::cross_product on Windows MSVC

Open efifogel opened this issue 1 year ago • 3 comments

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

  • Operating system (Windows/64 bits):
  • Compiler:
  • Release or debug mode:
  • Specific flags used (if any):
  • CGAL version: master
  • Boost version: irrelevant
  • Other libraries versions if used (Eigen, TBB, etc.):

efifogel avatar Apr 11 '24 13:04 efifogel

@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 avatar Apr 19 '24 06:04 afabri

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

mglisse avatar Apr 21 '24 20:04 mglisse

@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.

lrineau avatar Apr 29 '24 14:04 lrineau