cmake fails to build as C++23 (error: invalid application of 'sizeof' to an incomplete type)
With clang 17.0.2 on macOS, building with std=c++20
works, but with std=c++23
I get:
/usr/local/latestclang/bin/../include/c++/v1/__memory/unique_ptr.h:66:19: error: invalid application of 'sizeof' to an incomplete type 'cmGlobalGenerator'
66 | static_assert(sizeof(_Tp) >= 0, "cannot delete an incomplete type");
| ^~~~~~~~~~~
/usr/local/latestclang/bin/../include/c++/v1/__memory/unique_ptr.h:300:7: note: in instantiation of member function 'std::default_delete<cmGlobalGenerator>::operator()' requested here
300 | __ptr_.second()(__tmp);
| ^
/usr/local/latestclang/bin/../include/c++/v1/__memory/unique_ptr.h:266:75: note: in instantiation of member function 'std::unique_ptr<cmGlobalGenerator>::reset' requested here
266 | _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { reset(); }
| ^
/Users/builder/external/CMake/Source/cmGlobalGeneratorFactory.h:62:14: note: in instantiation of member function 'std::unique_ptr<cmGlobalGenerator>::~unique_ptr' requested here
62 | return std::unique_ptr<cmGlobalGenerator>();
| ^
/Users/builder/external/CMake/Source/cmTarget.h:27:7: note: forward declaration of 'cmGlobalGenerator'
27 | class cmGlobalGenerator;
| ^