Skip to content

Do not implicitly call std::string(0 /* nullptr */). Fixes CI build.#136

Closed
inkdot7 wants to merge 1 commit intoISOLDESolenoidalSpectrometer:mainfrom
inkdot7:string_nullptr
Closed

Do not implicitly call std::string(0 /* nullptr */). Fixes CI build.#136
inkdot7 wants to merge 1 commit intoISOLDESolenoidalSpectrometer:mainfrom
inkdot7:string_nullptr

Conversation

@inkdot7
Copy link
Contributor

@inkdot7 inkdot7 commented Dec 3, 2025

The CI build failures looked like this:

c++ -c -Wall -Wextra -pthread -std=c++23 -m64 -fsized-deallocation -I/opt/root/include -g -fPIC -O3 -DUNIX -DPOSIX -DLINUX -DAME_FILE=\"/__w/ISSSort/ISSSort/data/mass_1.mas20\" -DSRIM_DIR=\"/__w/ISSSort/ISSSort/srim/\" -DCUR_DIR=\"/__w/ISSSort/ISSSort/\" -I./include -I. -c src/Calibration.cc -o src/Calibration.o
src/Calibration.cc: In member function ‘std::string ISSCalibration::CaenType(unsigned int, unsigned int)’:
src/Calibration.cc:627:16: error: use of deleted function ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::nullptr_t = std::nullptr_t]’
  627 |         return 0;
      |                ^
In file included from /usr/include/c++/15/string:56,
                 from /usr/include/c++/15/bits/locale_classes.h:42,
                 from /usr/include/c++/15/bits/ios_base.h:43,
                 from /usr/include/c++/15/ios:46,
                 from /usr/include/c++/15/bits/ostream.h:43,
                 from /usr/include/c++/15/ostream:42,
                 from /usr/include/c++/15/iostream:43,
                 from ./include/Calibration.hh:4,
                 from src/Calibration.cc:1:
/usr/include/c++/15/bits/basic_string.h:835:7: note: declared here
  835 |       basic_string(nullptr_t) = delete;
      |       ^~~~~~~~~~~~
src/Calibration.cc:627:16: note: use ‘-fdiagnostics-all-candidates’ to display considered candidates
  627 |         return 0;
      |                ^

Example: https://github.com/inkdot7/ISSSort/actions/runs/19911360575/job/57080553420

I think this suggests std::string(0) is undefined behaviour (section 'Exception safety'):

https://cplusplus.com/reference/string/string/string/

@lpgaff
Copy link
Contributor

lpgaff commented Jan 15, 2026

overtaken by changes in #139

@lpgaff lpgaff closed this Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments