Skip to content

Conversation

@smuzaffar
Copy link
Contributor

In CPP23_X, there are many build errors like [a]. This change should fix all these error.

[a]

  48868 FWCore/Utilities/interface/Exception.h:166</a>:12: error: cannot bind non-const lvalue reference of type 'cms::Exception&amp;' to an rvalue of type 'cms::Exception'
      2 FWCore/Utilities/interface/Exception.h:166</a>:12: error: cannot bind non-const lvalue reference of type 'cond::persistency::Exception&amp;' to an rvalue of type 'cond::persistency::Exception'
   2216 FWCore/Utilities/interface/Exception.h:166</a>:12: error: cannot bind non-const lvalue reference of type 'edm::Exception&amp;' to an rvalue of type 'edm::Exception'
     26 FWCore/Utilities/interface/Exception.h:166</a>:12: error: cannot bind non-const lvalue reference of type 'TritonException&amp;' to an rvalue of type 'TritonException'
      2 FWCore/Utilities/interface/Exception.h:166</a>:12: error: cannot bind non-const lvalue reference of type 'VertexException&amp;' to an rvalue of type 'VertexException'
    251 FWCore/Utilities/interface/Exception.h:166</a>:12: error: non-const lvalue reference to type 'cms::Exception' cannot bind to a temporary of type 'cms::Exception'
      7 FWCore/Utilities/interface/Exception.h:166</a>:12: error: non-const lvalue reference to type 'edm::Exception' cannot bind to a temporary of type 'edm::Exception'
      4 FWCore/Utilities/interface/Exception.h:173</a>:12: error: cannot bind non-const lvalue reference of type 'cms::Exception&amp;' to an rvalue of type 'cms::Exception'
      2 FWCore/Utilities/interface/Exception.h:180</a>:12: error: cannot bind non-const lvalue reference of type 'cms::Exception&amp;' to an rvalue of type 'cms::Exception'

@cmsbuild
Copy link
Contributor

cmsbuild commented Dec 13, 2025

cms-bot internal usage

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @smuzaffar for master.

It involves the following packages:

  • FWCore/Utilities (core)

@Dr15Jones, @cmsbuild, @makortel, @smuzaffar can you please review it and eventually sign? Thanks.
@felicepantaleo, @makortel, @wddgit this is something you requested to watch as well.
@ftenchini, @mandrenguyen, @sextonkennedy you are the release manager for this.

cms-bot commands are listed here

@smuzaffar
Copy link
Contributor Author

please test for CMSSW_16_0_CPP23_X

@smuzaffar
Copy link
Contributor Author

please test

@cmsbuild
Copy link
Contributor

-1

Failed Tests: Build HeaderConsistency
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-52c53c/49951/summary.html
COMMIT: 168e6fc
CMSSW: CMSSW_16_0_CPP23_X_2025-12-12-1100/el8_amd64_gcc14
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/49626/49951/install.sh to create a dev area with all the needed externals and cmssw changes.

Failed Build

I found compilation error when building:

/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02919/el8_amd64_gcc14/external/gcc/14.3.1-724da22786638848892aa9ded8fcd995/bin/c++ -c -DCMS_MICRO_ARCH='x86-64-v3' -DGNU_GCC -D_GNU_SOURCE -DTBB_USE_GLIBCXX_VERSION=140301 -DTBB_SUPPRESS_DEPRECATED_MESSAGES -DTBB_PREVIEW_RESUMABLE_TASKS=1 -DTBB_PREVIEW_TASK_GROUP_EXTENSIONS=1 -DBOOST_SPIRIT_THREADSAFE -DPHOENIX_THREADSAFE -DBOOST_MATH_DISABLE_STD_FPCLASSIFY -DBOOST_UUID_RANDOM_PROVIDER_FORCE_POSIX -DBOOST_MPL_IGNORE_PARENTHESES_WARNING -DCMSSW_GIT_HASH='CMSSW_16_0_CPP23_X_2025-12-12-1100' -DPROJECT_NAME='CMSSW' -DPROJECT_VERSION='CMSSW_16_0_CPP23_X_2025-12-12-1100' -Isrc -Ipoison -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02919/el8_amd64_gcc14/cms/cmssw/CMSSW_16_0_CPP23_X_2025-12-12-1100/src -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02919/el8_amd64_gcc14/external/onnxruntime/1.20.1-e8c22c550be936056ecc6fb7037d5db8/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02919/el8_amd64_gcc14/external/pcre/8.43-dd87967f31bc038bf6a8abe2be06d878/include -isystem/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02919/el8_amd64_gcc14/external/boost/1.80.0-8a64405f8ffec5e0aed411e7e9db26fe/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02919/el8_amd64_gcc14/external/bz2lib/1.0.6-a45a4a64bd925bd0ba8954d249304f19/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02919/el8_amd64_gcc14/external/cppunit/1.15.x-cab1f5c16961d3146ed5b5b58dbaf0f2/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02919/el8_amd64_gcc14/external/libuuid/2.34-767b094004db7bc5bb18e2c4125785ec/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02919/el8_amd64_gcc14/external/protobuf/3.21.9-a596ab8f795bc24a6d33407d76b5f949/include -isystem/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02919/el8_amd64_gcc14/lcg/root/6.36.07-93a76a9d7334f41e96e83c8ce0904e5e/include -isystem/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02919/el8_amd64_gcc14/external/tbb/v2022.3.0-59c3435ec417bb8fae66d50fede7459e/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02919/el8_amd64_gcc14/external/xz/5.6.4-d44dfda29fc121dff35f6cb17845463b/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02919/el8_amd64_gcc14/external/zlib/1.2.13-8abc0804c1703682302a8801f051fa9d/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02919/el8_amd64_gcc14/external/md5/1.0.0-4c04fac6c42256d53fbdabb58aa703f3/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02919/el8_amd64_gcc14/external/re2/2021-06-01-ce65e95e12e2879f99e3522b2e14de6b/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02919/el8_amd64_gcc14/external/tinyxml2/6.2.0-776d06aaa678176c86223e685b2807b3/include -O3 -pthread -pipe -Werror=main -Werror=pointer-arith -Werror=overlength-strings -Wno-vla -Werror=overflow -std=c++23 -ftree-vectorize -Werror=array-bounds -Werror=format-contains-nul -Werror=type-limits -fvisibility-inlines-hidden -fno-math-errno --param vect-max-version-for-alias-checks=50 -Xassembler --compress-debug-sections -Wno-error=array-bounds -Warray-bounds -fuse-ld=bfd -march=x86-64-v3 -felide-constructors -fmessage-length=0 -Wall -Wno-non-template-friend -Wno-long-long -Wreturn-type -Wextra -Wpessimizing-move -Wclass-memaccess -Wno-cast-function-type -Wno-unused-but-set-parameter -Wno-ignored-qualifiers -Wno-unused-parameter -Wunused -Wparentheses -Werror=return-type -Werror=unused-value -Werror=unused-label -Werror=address -Werror=format -Werror=sign-compare -Werror=write-strings -Werror=delete-non-virtual-dtor -Werror=strict-aliasing -Werror=narrowing -Werror=unused-but-set-variable -Werror=reorder -Werror=unused-variable -Werror=conversion-null -Werror=return-local-addr -Wnon-virtual-dtor -Werror=switch -fdiagnostics-show-option -Wno-unused-local-typedefs -Wno-attributes -Wno-psabi -Wno-error=unused-variable -DBOOST_DISABLE_ASSERTS -flto=auto -fipa-icf -flto-odr-type-merging -fno-fat-lto-objects -Wodr -fPIC -MMD -MF tmp/el8_amd64_gcc14/src/PhysicsTools/ONNXRuntime/test/testONNXRuntime/testRunner.cpp.d src/PhysicsTools/ONNXRuntime/test/testRunner.cpp -o tmp/el8_amd64_gcc14/src/PhysicsTools/ONNXRuntime/test/testONNXRuntime/testRunner.cpp.o
>> Building binary testONNXRuntime
/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02919/el8_amd64_gcc14/external/gcc/14.3.1-724da22786638848892aa9ded8fcd995/bin/c++ -O3 -pthread -pipe -Werror=main -Werror=pointer-arith -Werror=overlength-strings -Wno-vla -Werror=overflow -std=c++23 -ftree-vectorize -Werror=array-bounds -Werror=format-contains-nul -Werror=type-limits -fvisibility-inlines-hidden -fno-math-errno --param vect-max-version-for-alias-checks=50 -Xassembler --compress-debug-sections -Wno-error=array-bounds -Warray-bounds -fuse-ld=bfd -march=x86-64-v3 -felide-constructors -fmessage-length=0 -Wall -Wno-non-template-friend -Wno-long-long -Wreturn-type -Wextra -Wpessimizing-move -Wclass-memaccess -Wno-cast-function-type -Wno-unused-but-set-parameter -Wno-ignored-qualifiers -Wno-unused-parameter -Wunused -Wparentheses -Werror=return-type -Werror=unused-value -Werror=unused-label -Werror=address -Werror=format -Werror=sign-compare -Werror=write-strings -Werror=delete-non-virtual-dtor -Werror=strict-aliasing -Werror=narrowing -Werror=unused-but-set-variable -Werror=reorder -Werror=unused-variable -Werror=conversion-null -Werror=return-local-addr -Wnon-virtual-dtor -Werror=switch -fdiagnostics-show-option -Wno-unused-local-typedefs -Wno-attributes -Wno-psabi -Wno-error=unused-variable -DBOOST_DISABLE_ASSERTS -flto=auto -fipa-icf -flto-odr-type-merging -fno-fat-lto-objects -Wodr -fPIC  tmp/el8_amd64_gcc14/src/PhysicsTools/ONNXRuntime/test/testONNXRuntime/testONNXRuntime.cc.o tmp/el8_amd64_gcc14/src/PhysicsTools/ONNXRuntime/test/testONNXRuntime/testRunner.cpp.o -Wl,-E -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-z,noexecstack -L/data/cmsbld/jenkins/workspace/ib-run-pr-tests/CMSSW_16_0_CPP23_X_2025-12-12-1100/biglib/el8_amd64_gcc14 -L/data/cmsbld/jenkins/workspace/ib-run-pr-tests/CMSSW_16_0_CPP23_X_2025-12-12-1100/lib/el8_amd64_gcc14 -L/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02919/el8_amd64_gcc14/cms/cmssw/CMSSW_16_0_CPP23_X_2025-12-12-1100/biglib/el8_amd64_gcc14 -L/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02919/el8_amd64_gcc14/cms/cmssw/CMSSW_16_0_CPP23_X_2025-12-12-1100/lib/el8_amd64_gcc14 -L/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02919/el8_amd64_gcc14/cms/cmssw/CMSSW_16_0_CPP23_X_2025-12-12-1100/external/el8_amd64_gcc14/lib -L/data/cmsbld/jenkins/workspace/ib-run-pr-tests/CMSSW_16_0_CPP23_X_2025-12-12-1100/static/el8_amd64_gcc14 -L/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02919/el8_amd64_gcc14/cms/cmssw/CMSSW_16_0_CPP23_X_2025-12-12-1100/static/el8_amd64_gcc14 -lFWCoreParameterSet -lFWCoreMessageLogger -lDataFormatsProvenance -lFWCorePluginManager -lFWCoreReflection -lPhysicsToolsONNXRuntime -lFWCoreUtilities -lTree -lNet -lThread -lMathCore -lRIO -lCore -lboost_thread -lboost_date_time -lonnxruntime -lpcre -lbz2 -lcppunit -luuid -lprotobuf -ltbb -llzma -lz -lcms-md5 -lre2 -lcrypt -ldl -lrt -lstdc++fs -ltinyxml2 -o tmp/el8_amd64_gcc14/src/PhysicsTools/ONNXRuntime/test/testONNXRuntime/testONNXRuntime
/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02919/el8_amd64_gcc14/external/gcc/14.3.1-724da22786638848892aa9ded8fcd995/bin/../lib/gcc/x86_64-redhat-linux-gnu/14.3.1/../../../../x86_64-redhat-linux-gnu/bin/ld.bfd: tmp/el8_amd64_gcc14/src/PhysicsTools/ONNXRuntime/test/testONNXRuntime/ccrvAjWF.ltrans0.ltrans.o: in function `testONNXRuntime::checkGPU()':
:(.text+0x1b4d): undefined reference to `cms::cudatest::testDevices()'
collect2: error: ld returned 1 exit status
>> Deleted: tmp/el8_amd64_gcc14/src/PhysicsTools/ONNXRuntime/test/testONNXRuntime/testONNXRuntime
gmake: *** [tmp/el8_amd64_gcc14/src/PhysicsTools/ONNXRuntime/test/testONNXRuntime/testONNXRuntime] Error 1
>> Leaving Package PhysicsTools/ONNXRuntime
>> Package PhysicsTools/ONNXRuntime built
>> Entering Package SimDataFormats/Forward


@cmsbuild
Copy link
Contributor

-1

Failed Tests: Build
Size: This PR adds an extra 24KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-52c53c/49952/summary.html
COMMIT: 168e6fc
CMSSW: CMSSW_16_0_X_2025-12-13-1100/el8_amd64_gcc13
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/49626/49952/install.sh to create a dev area with all the needed externals and cmssw changes.

Failed Build

I found compilation error when building:

                 from src/DataFormats/Common/interface/ConvertHandle.h:6,
                 from src/FWCore/Framework/interface/Event.h:21,
                 from src/FWCore/TestModules/plugins/GlobalVectorAnalyzer.cc:3:
src/FWCore/Utilities/interface/Exception.h: In instantiation of 'E&& cms::operator<<(E&&, const T&) [with E = Exception; T = std::vector]':
src/FWCore/TestModules/plugins/GlobalVectorAnalyzer.cc:56:69:   required from here
src/FWCore/Utilities/interface/Exception.h:166:12: error: no match for 'operator<<' (operand types are 'std::ostringstream' {aka 'std::__cxx11::basic_ostringstream'} and 'const std::vector')
  166 |     e.ost_ << stuff;
      |     ~~~~~~~^~~~~~~~
In file included from /cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02919/el8_amd64_gcc13/external/gcc/13.4.0-6908cfdf803923e783448096ca4f0923/include/c++/13.4.0/bits/unique_ptr.h:42,
                 from /cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02919/el8_amd64_gcc13/external/gcc/13.4.0-6908cfdf803923e783448096ca4f0923/include/c++/13.4.0/memory:78,
                 from /cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02919/el8_amd64_gcc13/lcg/root/6.36.07-0490e78b33943d48f9af1c19441a9d2e/include/ROOT/TypeTraits.hxx:15,


@makortel
Copy link
Contributor

By quick thought returning an argument captured via universal reference as lvalue reference (i.e. present code) smells, but I'm not sure if the return type is now the universal reference or an rvalue reference.

I'm tempted to argue the way the universal references were introduced here in #23801 was subtly flawed, but I need more time to digest.

@Dr15Jones
Copy link
Contributor

It looks like changing the first line

namespace {
template <typename T>
T& operator<<(T& out, std::vector<double> const& values) {
if (values.empty()) {
out << "{}";
return out;
}
auto it = values.begin();
out << "{ " << *it;
++it;
while (it != values.end()) {
out << ", " << *it;
++it;
}
out << " }";
return out;
}
} // namespace

to namespace std { solves the issue. That allows argument dependent namespace lookup to be used to disambiguate the call.

@makortel
Copy link
Contributor

makortel commented Dec 15, 2025

Apparently there was a wording change in this specific situation in C++23, see "Simpler implicit move" in https://developers.redhat.com/articles/2023/06/21/new-c-features-gcc-13

GCC13 porting guide https://gcc.gnu.org/gcc-13/porting_to.html suggest to use decltype(auto) as the return type when the universal reference is used as an argument

  inline decltype(auto) operator<<(E&& e, std::ostream& (*f)(std::ostream&)) {
    f(e.ost_);
    return std::forward<E>(e);
  }

(I don't know if decltype(auto) works in function declarations)

The overload in GlobalVectorAnalyzer would have to be modified correspondingly.

At least on a simple compiler explorer test https://godbolt.org/z/3fbhT7j8x that approach seems to work in C++20 as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants