Files
cbindgen/tests/expectations/struct_literal_order.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

29 lines
710 B
C++

#include <cstdarg>
#include <cstdint>
#include <cstdlib>
#include <new>
struct ABC {
float a;
uint32_t b;
uint32_t c;
};
static const ABC ABC_abc = ABC{ /* .a = */ 1.0, /* .b = */ 2, /* .c = */ 3 };
static const ABC ABC_bac = ABC{ /* .a = */ 1.0, /* .b = */ 2, /* .c = */ 3 };
static const ABC ABC_cba = ABC{ /* .a = */ 1.0, /* .b = */ 2, /* .c = */ 3 };
struct BAC {
uint32_t b;
float a;
int32_t c;
};
static const BAC BAC_abc = BAC{ /* .b = */ 1, /* .a = */ 2.0, /* .c = */ 3 };
static const BAC BAC_bac = BAC{ /* .b = */ 1, /* .a = */ 2.0, /* .c = */ 3 };
static const BAC BAC_cba = BAC{ /* .b = */ 1, /* .a = */ 2.0, /* .c = */ 3 };
extern "C" {
void root(ABC a1, BAC a2);
} // extern "C"