google / s2geometry

Computational geometry and spatial indexing on the sphere
http://s2geometry.io/
Apache License 2.0
2.29k stars 302 forks source link

Fix build with libcxx16 #373

Closed rschu1ze closed 2 months ago

rschu1ze commented 2 months ago

Found while upgrading LLVM in ClickHouse (which uses s2geometry).

The code is structured like this:

class S2Polyline {

  class OwningShape {
      std::unique_ptr<S2Polyline> owned_polyline_;
  };
};

libcxx 16 complains that S2Polyline is not defined at the point where the dtor of the unique_ptr is called (which is OwningShape's implicitly declared default destructor in the same header file) (also see [0]).

As a remedy, declare OwningShape's destructor in the source file where the full declaration of S2Polyline is visible.

[0] https://stackoverflow.com/a/34073093/22422288)