Files
cbindgen/tests/expectations/struct_literal.cpp
T
Gyusun Yeom 3f9e54b775 Initialize struct literal with list-initializer for C++11 standard (#401)
* Emit struct literal with list-initializer when language is Cxx

* Update test results

* Add test case - struct literal order

* Memoize struct field names

* Specify struct type at front of initializer
2019-11-17 19:28:40 +01:00

26 lines
448 B
C++

#include <cstdarg>
#include <cstdint>
#include <cstdlib>
#include <new>
struct Bar;
struct Foo {
int32_t a;
uint32_t b;
};
static const Foo Foo_FOO = Foo{ /* .a = */ 42, /* .b = */ 47 };
static const Foo Foo_FOO2 = Foo{ /* .a = */ 42, /* .b = */ 47 };
static const Foo Foo_FOO3 = Foo{ /* .a = */ 42, /* .b = */ 47 };
static const Foo BAR = Foo{ /* .a = */ 42, /* .b = */ 1337 };
extern "C" {
void root(Foo x, Bar bar);
} // extern "C"