Libtorch project with clang-tidy produces errors

I’m having an odd error with clang-tidy, when changing the C++ standard from 17 to 20. Here is a simple reproducible example:

main.cpp

#include <torch/torch.h>
int main() {
    return 0;
}

CMakeLists.txt

cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(example-app)

find_package(Torch REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}")

add_executable(main main.cpp)
target_link_libraries(main "${TORCH_LIBRARIES}")
set_property(TARGET main PROPERTY CXX_STANDARD 17)
target_compile_options(main PUBLIC
    -Wall -Wextra
)

Running cmake to produce the compile commands:

mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCMAKE_PREFIX_PATH=/usr/local/libtorch ..
cp compile_commands.json ..  && cd ..

Finally, running clang-tidy -p . main.cpp produces no warning/errors.

If however CXX_STANDARD 20 is used instead, the following error is produced by clang-tidy.

clang-tidy -p . main.cpp
Error while processing /home/tuero/Documents/test/test_torch/main.cpp.
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_construct.h:188:7: error: static assertion failed due to requirement 'is_destructible<c10::IValue>::value': value type is destructible [clang-diagnostic-error]
      static_assert(is_destructible<_Value_type>::value,
      ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/alloc_traits.h:850:7: note: in instantiation of function template specialization 'std::_Destroy<__gnu_cxx::__normal_iterator<c10::IValue *, std::vector<c10::IValue>>>' requested here
      _Destroy(__first, __last);
      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/vector.tcc:244:13: note: in instantiation of function template specialization 'std::_Destroy<__gnu_cxx::__normal_iterator<c10::IValue *, std::vector<c10::IValue>>, c10::IValue>' requested here
              std::_Destroy(std::copy(__x.begin(), __x.end(), begin()),
                   ^
/usr/local/libtorch/include/ATen/core/ivalue_inl.h:432:25: note: in instantiation of member function 'std::vector<c10::IValue>::operator=' requested here
        elementsVector_ = rhs.elementsVector_;
                        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_uninitialized.h:125:4: error: no matching function for call to '_Destroy' [clang-diagnostic-error]
          std::_Destroy(__result, __cur);
          ^~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_uninitialized.h:370:14: note: in instantiation of function template specialization 'std::__do_uninit_copy<const c10::IValue *, c10::IValue *>' requested here
        return std::__do_uninit_copy(__first, __last, __result);
                    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_vector.h:1690:11: note: in instantiation of function template specialization 'std::__uninitialized_copy_a<const c10::IValue *, c10::IValue *, c10::IValue>' requested here
            std::__uninitialized_copy_a(__first, __last,
                 ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_vector.h:706:4: note: in instantiation of function template specialization 'std::vector<c10::IValue>::_M_range_initialize<const c10::IValue *>' requested here
          _M_range_initialize(__first, __last,
          ^
/usr/local/libtorch/include/ATen/core/ivalue_inl.h:353:32: note: in instantiation of function template specialization 'std::vector<c10::IValue>::vector<const c10::IValue *, void>' requested here
        new (&elementsVector_) std::vector<IValue>(elements.begin(), elements.end());
                               ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_construct.h:182:5: note: candidate template ignored: substitution failure [with _ForwardIterator = c10::IValue *]
    _Destroy(_ForwardIterator __first, _ForwardIterator __last)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_construct.h:146:5: note: candidate function template not viable: requires single argument '__pointer', but 2 arguments were provided
    _Destroy(_Tp* __pointer)
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/alloc_traits.h:832:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
    _Destroy(_ForwardIterator __first, _ForwardIterator __last,
    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/alloc_traits.h:847:5: note: candidate function template not viable: requires 3 arguments, but 2 were provided
    _Destroy(_ForwardIterator __first, _ForwardIterator __last,

Here are my versions:

$ g++ --version
g++ (Ubuntu 11.3.0-6ubuntu1) 11.3.0
$ clang-14 --version
Ubuntu clang version 14.0.6-2
$ clang-15 --version
Ubuntu clang version 15.0.7
$ cat /usr/local/libtorch/build-version
2.0.1+cu118