Clang 18 as of 2024-01-06 has some trouble with a construct in llvm 10's Optional.h header, resulting in errors building devel/llvm10: In file included from /wrkdirs/usr/ports/devel/llvm10/work/llvm-10.0.1.src/lib/Support/ARMTargetParser.cpp:14: In file included from /wrkdirs/usr/ports/devel/llvm10/work/llvm-10.0.1.src/include/llvm/Support/ARMTargetParser.h:17: In file included from /wrkdirs/usr/ports/devel/llvm10/work/llvm-10.0.1.src/include/llvm/ADT/StringRef.h:12: In file included from /wrkdirs/usr/ports/devel/llvm10/work/llvm-10.0.1.src/include/llvm/ADT/STLExtras.h:19: /wrkdirs/usr/ports/devel/llvm10/work/llvm-10.0.1.src/include/llvm/ADT/Optional.h:289:8: error: cannot overload a member function with ref-qualifier '&&' with a member function without a ref-qualifier 289 | auto map(const Function &F) && | ^ /wrkdirs/usr/ports/devel/llvm10/work/llvm-10.0.1.src/include/llvm/ADT/Optional.h:272:8: note: previous declaration is here 272 | auto map(const Function &F) const | ^ A similar issue has been reported to llvm upstream, but it is not clear yet whether this is a clang regression or an intended behavior. In the mean time, we can apply https://github.com/llvm/llvm-project/commit/90cfbb81674ec to make the port build with clang 18, as a workaround.
Created attachment 247489 [details] devel/llvm10: fix build with clang 18
In the mean time upstream has committed a fix for the "cannot overload a member function with ref-qualifier '&&' with a member function without a ref-qualifier" error, which was also popping up in other ports: https://github.com/llvm/llvm-project/issues/76358 Once I have merged a newer snapshot of llvm 18 to the llvm-18-update branch, I think this bug is no longer necessary. But I'll have to rebuild my whole ports collection to double-check it, so it might take a while. :)
Upstream fixed this in https://github.com/llvm/llvm-project/commit/69066ab31959968ebcbca71f3872bdedef8fb8cd, and I imported a later revision of llvm 18 in https://github.com/DimitryAndric/freebsd-src/commit/3b076e737af3b4ac1b7dc03bdd2b4cca9a0a9590 . After that, devel/llvm10 builds without the additional patch, so this bug is no longer needed.