seanbaxter / circle

The compiler is available for download. Get it!
http://www.circle-lang.org/
2.42k stars 74 forks source link

Segmentation fault when using `enum` instead of `enum class` #165

Open 0x2Adr1 opened 1 year ago

0x2Adr1 commented 1 year ago
$ circle --version
circle version 1.0.0-191
  Circle public preview build 191
  Built Apr 28 2023 16:55:43
  (c) 2023 Sean Baxter
  https://www.circle-lang.org/
  Twitter: @seanbax
#include <array>

enum EPlanet {
    Venus = 0,
};

struct CPlanet {
    const EPlanet planet;
};

static const std::array<CPlanet, 1> planets = { {
    {
        .planet = EPlanet::Venus,
    },
} };

int main()
{
        return 0;
}
$ circle a.cpp -o foo
Segmentation fault

Now replace enum EPlanet with enum class EPlanet and it compiles successfully.