circle
circle copied to clipboard
Segmentation fault with union and constexpr
Hello,
I encountered a segmentation fault when compiling code involving constexpr and union.
Here is the minimal reproducible case :
#include <array>
struct Coord {
union {
struct {
int x;
int y;
};
struct {
int first;
int second;
};
};
};
constexpr std::array<Coord, 4> dirs = {Coord{0, -1}, {1, 0}, {0, 1}, {-1, 0}};
int main() {
return 0;
}
If the union or the constexpr is removed, the compilation becomes functional.
circle version 1.0.0-200
Circle public preview build 200
Built Jul 29 2023 11:15:57 EDT
Also segfault with the sample shown bellow see discussion here https://github.com/robertoraggi/cplusplus/issues/311 .
void test()
{
int i;
( ({ long __cpu = ((long) i); }));
}
Any union seems to segfault the compiler. Minimal repro (creduce'd from actual code):
typedef union {
} a;
a b{};