Compile error with CentOS Stream 9 / Fedora 36
It seems that MINSIGSTKSZ
expands to a call to sysconf
now, which is not allowed in constexpr
. gcc version is 11.3.1 (C9) / 12.0.1 (F36).
[ 25s] [ 66%] Building CXX object test/CMakeFiles/KVectorTest.dir/catch2.cpp.o
[ 25s] cd /home/abuild/rpmbuild/BUILD/libheinz-0.1.3/build/redhat-linux-build/test && /usr/bin/g++ -I/home/abuild/rpmbuild/BUILD/libheinz-0.1.3/test -I/home/abuild/rpmbuild/BUILD/libheinz-0.1.3/inc -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -Wall -Wno-unknown-pragmas -pedantic -std=gnu++17 -MD -MT test/CMakeFiles/KVectorTest.dir/KVectorTest.cpp.o -MF CMakeFiles/KVectorTest.dir/KVectorTest.cpp.o.d -o CMakeFiles/KVectorTest.dir/KVectorTest.cpp.o -c /home/abuild/rpmbuild/BUILD/libheinz-0.1.3/test/KVectorTest.cpp
[ 25s] cd /home/abuild/rpmbuild/BUILD/libheinz-0.1.3/build/redhat-linux-build/test && /usr/bin/g++ -I/home/abuild/rpmbuild/BUILD/libheinz-0.1.3/test -I/home/abuild/rpmbuild/BUILD/libheinz-0.1.3/inc -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -Wall -Wno-unknown-pragmas -pedantic -std=gnu++17 -MD -MT test/CMakeFiles/KVectorTest.dir/catch2.cpp.o -MF CMakeFiles/KVectorTest.dir/catch2.cpp.o.d -o CMakeFiles/KVectorTest.dir/catch2.cpp.o -c /home/abuild/rpmbuild/BUILD/libheinz-0.1.3/test/catch2.cpp
[ 26s] In file included from /usr/include/signal.h:328,
[ 26s] from /home/abuild/rpmbuild/BUILD/libheinz-0.1.3/test/catch.hpp:6323,
[ 26s] from /home/abuild/rpmbuild/BUILD/libheinz-0.1.3/test/catch2.cpp:2:
[ 26s] /home/abuild/rpmbuild/BUILD/libheinz-0.1.3/test/catch.hpp:9041:58: error: call to non-'constexpr' function 'long int sysconf(int)'
[ 26s] 9041 | constexpr static std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
[ 26s] | ^~~~~~~~~~~
[ 26s] In file included from /usr/include/bits/sigstksz.h:24:
[ 26s] /usr/include/unistd.h:640:17: note: 'long int sysconf(int)' declared here
[ 26s] 640 | extern long int sysconf (int __name) __THROW;
[ 26s] | ^~~~~~~
[ 26s] /home/abuild/rpmbuild/BUILD/libheinz-0.1.3/test/catch.hpp:9100:45: error: size of array 'altStackMem' is not an integral constant-expression
[ 26s] 9100 | char FatalConditionHandler::altStackMem[sigStackSize] = {};
[ 26s] | ^~~~~~~~~~~~
[ 26s] In file included from /usr/include/signal.h:328,
[ 26s] from /home/abuild/rpmbuild/BUILD/libheinz-0.1.3/test/catch.hpp:6323,
[ 26s] from /home/abuild/rpmbuild/BUILD/libheinz-0.1.3/test/catch2.cpp:2:
[ 26s] /home/abuild/rpmbuild/BUILD/libheinz-0.1.3/test/catch.hpp:9041:58: error: call to non-'constexpr' function 'long int sysconf(int)'
[ 26s] 9041 | constexpr static std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
[ 26s] | ^~~~~~~~~~~
[ 26s] In file included from /usr/include/bits/sigstksz.h:24:
[ 26s] /usr/include/unistd.h:640:17: note: 'long int sysconf(int)' declared here
[ 26s] 640 | extern long int sysconf (int __name) __THROW;
[ 26s] | ^~~~~~~
[ 26s] /home/abuild/rpmbuild/BUILD/libheinz-0.1.3/test/catch.hpp:9100:45: error: size of array 'altStackMem' is not an integral constant-expression
[ 26s] 9100 | char FatalConditionHandler::altStackMem[sigStackSize] = {};
[ 26s] | ^~~~~~~~~~~~