When I compile this code with clan
g++ main.cpp && ./a.out
I get a segfault (terminated by signal SIGSEGV (Adressbereichsfehler)
).
gcc-Version 9.3.0
clang version 9.0.1
#include <random>
struct Abra
{
float hagrid[3000000];
std::random_device voldemort{};
};
int main()
{
Abra harry = {};
return 0;
}
Why is that and how can I fix this? What I tried is to switch the declaration order of hagrid
and voldemort
but it still segfaults (Coliru example)