Skip to content

clang21/22 compilation issue with CMAKE_CXX_STANDARD=23 #5187

@elmsheus

Description

@elmsheus

Hi,

while doing compilation tests of AthenaExternals/Athena with clang21 and clang22 I ran into a compilation issue with ACTS and CMAKE_CXX_STANDARD=23 while this works fine with CMAKE_CXX_STANDARD=20 (or also with gcc15):

In file included from /build1/elmsheus/clang21_20260303/build/build/AthenaExternals/src/Acts/Core/include/Acts/Geometry/CylinderLayer.hpp:12:
In file included from /build1/elmsheus/clang21_20260303/build/build/AthenaExternals/src/Acts/Core/include/Acts/Geometry/ApproachDescriptor.hpp:13:
In file included from /build1/elmsheus/clang21_20260303/build/build/AthenaExternals/src/Acts/Core/include/Acts/Propagator/NavigationTarget.hpp:11:
In file included from /build1/elmsheus/clang21_20260303/build/build/AthenaExternals/src/Acts/Core/include/Acts/Geometry/BoundarySurfaceT.hpp:14:
In file included from /build1/elmsheus/clang21_20260303/build/build/AthenaExternals/src/Acts/Core/include/Acts/Surfaces/RegularSurface.hpp:12:
In file included from /build1/elmsheus/clang21_20260303/build/build/AthenaExternals/src/Acts/Core/include/Acts/Surfaces/Surface.hpp:18:
In file included from /build1/elmsheus/clang21_20260303/build/build/AthenaExternals/src/Acts/Core/include/Acts/Geometry/Polyhedron.hpp:12:
In file included from /build1/elmsheus/clang21_20260303/build/build/AthenaExternals/src/Acts/Core/include/Acts/Geometry/Extent.hpp:16:
In file included from /build1/elmsheus/clang21_20260303/build/build/AthenaExternals/src/Acts/Core/include/Acts/Utilities/Helpers.hpp:18:
In file included from /cvmfs/sft.cern.ch/lcg/contrib/gcc/14.2.0/x86_64-el9/lib/gcc/x86_64-pc-linux-gnu/14.2.0/../../../../include/c++/14.2.0/memory:78:
/cvmfs/sft.cern.ch/lcg/contrib/gcc/14.2.0/x86_64-el9/lib/gcc/x86_64-pc-linux-gnu/14.2.0/../../../../include/c++/14.2.0/bits/unique_ptr.h:91:16: error: invalid application of 'sizeof' to an incomplete type 'Acts::SurfaceArray'
   91 |         static_assert(sizeof(_Tp)>0,
      |                       ^~~~~~~~~~~
/cvmfs/sft.cern.ch/lcg/contrib/gcc/14.2.0/x86_64-el9/lib/gcc/x86_64-pc-linux-gnu/14.2.0/../../../../include/c++/14.2.0/bits/unique_ptr.h:398:4: note: in instantiation of member function 'std::default_delete<Acts::SurfaceArray>::operator()' requested here
  398 |           get_deleter()(std::move(__ptr));
      |           ^
/build1/elmsheus/clang21_20260303/build/build/AthenaExternals/src/Acts/Core/include/Acts/Geometry/CylinderLayer.hpp:47:52: note: in instantiation of member function 'std::unique_ptr<Acts::SurfaceArray>::~unique_ptr' requested here
   47 |       std::unique_ptr<SurfaceArray> surfaceArray = nullptr,
      |                                                    ^
/build1/elmsheus/clang21_20260303/build/build/AthenaExternals/src/Acts/Core/include/Acts/Geometry/Layer.hpp:29:7: note: forward declaration of 'Acts::SurfaceArray'
   29 | class SurfaceArray;
      |       ^

Here is how to reproduce it when compiling the full AthenaExternals (with some patch for Gaudi):

$ ssh myfastmachine.cern.ch
$ setupATLAS
$ asetup none,clang21,opt,cmakesetup,cuda --cmakeversion=4.2.1 --cudaversion=13.1
$ export AtlasExternals_REF=origin/gaudi_gcc15_20260302
$ export AtlasExternals_URL=https://gitlab.cern.ch/elmsheus/atlasexternals.git
$ export TDAQ_PLATFORM=x86_64-el9-gcc14-opt
$ export LCG_PLATFORM=x86_64-el9-gcc14-opt
$ CFLAGS="-Wno-deprecated-builtins" CXXFLAGS="-Wno-deprecated-builtins" ./athena/Projects/Athena/build_externals.sh -c -t Release -x -DATLAS_ONNXRUNTIME_SOURCE="URL;https://atlas-software-dist-eos.web.cern.ch/externals/onnxruntime/onnxruntime-linux-x64-gpu_cuda13-1.24.2.tgz" -x -DATLAS_GEANT4_USE_LTO=FALSE -x -DATLAS_VECGEOM_USE_LTO=FALSE -x -DCMAKE_CXX_STANDARD=23 -x -DCMAKE_CUDA_STANDARD=20 > external.log 2>&1 &

Edit: I think you will need in addition MR https://gitlab.cern.ch/gaudi/Gaudi/-/merge_requests/1900 for Gaudi, but I hope ACTS will fail early enough to demonstrate the problem ....

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions