circle
circle copied to clipboard
declaring multiple struct members with initializers within a single declaration does not compile
Circle (build 175) fails to compile the following C++ code:
struct foo {
int a = 1, b = 2;
};
error: foo.cpp:2:11
expected ';' after declaration
int a = 1, b = 2;
^
See https://godbolt.org/z/qqs8fMd1x (Circle) and https://godbolt.org/z/8o51T8cbd (Clang).
It works without initializers;
struct foo {
int a, b;
};
It also works inside a function:
void foo() {
int a = 1, b = 2;
}
I ran into this problem when trying to compile my project libopenmpt (https://github.com/OpenMPT/openmpt/) with Circle.