Skip to content

C++23 crash in DiagnosticInfo.h #17686

Closed
@elmsheus

Description

@elmsheus

Check duplicate issues.

  • Checked for duplicates

Description

I fully understand that ROOT 6.34/02 is not yet ready for the C++23 standard since it's explicitly disabled in the ROOT cmake configuration at https://github.com/root-project/root/blob/master/cmake/modules/CheckCompiler.cmake#L164C1-L164C43

I took my chances and have overwritten that setting and tried to compile ROOT 6.34/02 from source with gcc 14.2 and "-DCMAKE_CXX_STANDARD=23" in the ATLAS AnalysisBase configuration (https://gitlab.cern.ch/atlas/atlasexternals/-/blob/main/External/ROOT/CMakeLists.txt?ref_type=heads) and see the following compilation problem in ROOT/interpreter/llvm-project/llvm/include/llvm/IR/DiagnosticInfo.h:

[ 69%] Building CXX object interpreter/llvm-project/llvm/lib/Analysis/CMakeFiles/LLVMAnalysis.dir/IRSimilarityIdentifier.cpp.o
In file included from /build1/elmsheus/ana_20250206/root-build/src/ROOT/interpreter/llvm-project/llvm/include/llvm/Analysis/OptimizationRemarkEmitter.h:18,
                 from /build1/elmsheus/ana_20250206/root-build/src/ROOT/interpreter/llvm-project/llvm/lib/Analysis/InlineCost.cpp:26:
/build1/elmsheus/ana_20250206/root-build/src/ROOT/interpreter/llvm-project/llvm/include/llvm/IR/DiagnosticInfo.h: In instantiation of 'RemarkT& llvm::operator<<(RemarkT&&, std::enable_if_t<((bool)std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value), DiagnosticInfoOptimizationBase::Argument>) [with RemarkT = OptimizationRemarkMissed; std::enable_if_t<((bool)std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value), DiagnosticInfoOptimizationBase::Argument> = DiagnosticInfoOptimizationBase::Argument]':
/build1/elmsheus/ana_20250206/root-build/src/ROOT/interpreter/llvm-project/llvm/lib/Analysis/InlineCost.cpp:2584:36:   required from here
 2584 |                  << NV("Callee", &F) << " has uninlinable pattern ("
      |                                    ^
/build1/elmsheus/ana_20250206/root-build/src/ROOT/interpreter/llvm-project/llvm/include/llvm/IR/DiagnosticInfo.h:584:10: error: cannot bind non-const lvalue reference of type 'llvm::OptimizationRemarkMissed&' to an rvalue of type 'llvm::OptimizationRemarkMissed'
  584 |   return R;
      |          ^
In file included from /build1/elmsheus/ana_20250206/root-build/src/ROOT/interpreter/llvm-project/llvm/include/llvm/Analysis/OptimizationRemarkEmitter.h:18,
                 from /build1/elmsheus/ana_20250206/root-build/src/ROOT/interpreter/llvm-project/llvm/lib/Analysis/InlineAdvisor.cpp:19:
/build1/elmsheus/ana_20250206/root-build/src/ROOT/interpreter/llvm-project/llvm/include/llvm/IR/DiagnosticInfo.h: In instantiation of 'RemarkT& llvm::operator<<(RemarkT&&, std::enable_if_t<((bool)std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value), StringRef>) [with RemarkT = OptimizationRemarkMissed; std::enable_if_t<((bool)std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value), StringRef> = StringRef]':
/build1/elmsheus/ana_20250206/root-build/src/ROOT/interpreter/llvm-project/llvm/lib/Analysis/InlineAdvisor.cpp:94:19:   required from here
   94 |                << "'" << NV("Callee", Callee) << "' is not AlwaysInline into '"
      |                   ^~~
/build1/elmsheus/ana_20250206/root-build/src/ROOT/interpreter/llvm-project/llvm/include/llvm/IR/DiagnosticInfo.h:562:10: error: cannot bind non-const lvalue reference of type 'llvm::OptimizationRemarkMissed&' to an rvalue of type 'llvm::OptimizationRemarkMissed'
  562 |   return R;
      |          ^
gmake[6]: *** [interpreter/llvm-project/llvm/lib/Analysis/CMakeFiles/LLVMAnalysis.dir/build.make:692: interpreter/llvm-project/llvm/lib/Analysis/CMakeFiles/LLVMAnalysis.dir/InlineCost.cpp.o] Error 1
gmake[6]: *** Waiting for unfinished jobs....
gmake[6]: *** [interpreter/llvm-project/llvm/lib/Analysis/CMakeFiles/LLVMAnalysis.dir/build.make:706: interpreter/llvm-project/llvm/lib/Analysis/CMakeFiles/LLVMAnalysis.dir/InlineAdvisor.cpp.o] Error 1
[ 69%] Linking CXX static library ../../libLLVMCoverage.a
[ 69%] Built target LLVMCoverage
gmake[5]: *** [CMakeFiles/Makefile2:15517: interpreter/llvm-project/llvm/lib/Analysis/CMakeFiles/LLVMAnalysis.dir/all] Error 2
gmake[4]: *** [Makefile:156: all] Error 2
gmake[3]: *** [External/ROOT/CMakeFiles/ROOT.dir/build.make:93: src/ROOT-stamp/ROOT-build] Error 2
gmake[2]: *** [CMakeFiles/Makefile2:2373: External/ROOT/CMakeFiles/ROOT.dir/all] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:2380: External/ROOT/CMakeFiles/ROOT.dir/rule] Error 2
gmake: *** [Makefile:1083: ROOT] Error 2

Reproducer

See above

ROOT version

6.34/02

Installation method

from source

Operating system

RHEL9.5

Additional context

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions