Skip to content

MINSIGSTKSZ cannot be used for constexpr variable #52

@slinkinone

Description

@slinkinone

Error description

[1/4] Building CXX object test/CMakeFiles/catch_main.dir/catch_main.cpp.o
FAILED: test/CMakeFiles/catch_main.dir/catch_main.cpp.o 
/usr/bin/g++   -Wall -Wextra -pedantic -O3 -DNDEBUG -std=c++11 -MD -MT test/CMakeFiles/catch_main.dir/catch_main.cpp.o -MF test/CMakeFiles/catch_main.dir/catch_main.cpp.o.d -o test/CMakeFiles/catch_main.dir/catch_main.cpp.o -c /home/user/github/span/test/catch_main.cpp
In file included from /usr/include/signal.h:328,
                 from /home/user/github/span/test/catch.hpp:7712,
                 from /home/user/github/span/test/catch_main.cpp:3:
/home/user/github/span/test/catch.hpp:10453:58: error: call to non-‘constexpr’ function ‘long int sysconf(int)’
10453 |     static constexpr std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
      |                                                          ^~~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24,
                 from /usr/include/signal.h:328,
                 from /home/user/github/span/test/catch.hpp:7712,
                 from /home/user/github/span/test/catch_main.cpp:3:
/usr/include/unistd.h:640:17: note: ‘long int sysconf(int)’ declared here
  640 | extern long int sysconf (int __name) __THROW;
      |                 ^~~~~~~
In file included from /home/user/github/span/test/catch_main.cpp:3:
/home/user/github/span/test/catch.hpp:10512:45: error: size of array ‘altStackMem’ is not an integral constant-expression
10512 |     char FatalConditionHandler::altStackMem[sigStackSize] = {};
      |                                             ^~~~~~~~~~~~
ninja: build stopped: subcommand failed.

Compiling information

g++ --version
g++ (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
ldd --version
ldd (Ubuntu GLIBC 2.35-0ubuntu3.1) 2.35
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.


Hotfix

catch.hpp:

...
#elif defined ( CATCH_CONFIG_POSIX_SIGNALS )

#include <signal.h>

#undef MINSIGSTKSZ
#define MINSIGSTKSZ 16384

namespace Catch {
...

Useful links

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions