80da1f59aa
Opt-in since it uses a C++17 feature, but this allow exactly the same usage in C++ and Rust, which I think is nice. This also fixes constants of transparent structs in general, since the initial version of this patch broke a test (associated constants in enums), so I added a test for that too.
18 lines
258 B
C++
18 lines
258 B
C++
#include <cstdarg>
|
|
#include <cstdint>
|
|
#include <cstdlib>
|
|
|
|
struct Foo {
|
|
int32_t a;
|
|
uint32_t b;
|
|
};
|
|
static const Foo Foo_FOO = (Foo){ .a = 42, .b = 47 };
|
|
|
|
static const Foo BAR = (Foo){ .a = 42, .b = 1337 };
|
|
|
|
extern "C" {
|
|
|
|
void root(Foo x);
|
|
|
|
} // extern "C"
|