Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bindgen/ir/enumeration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,7 @@ impl Enum {
write!(out, ")");
out.open_brace();

write!(out, "{} result;", self.export_name);
write!(out, "{} result{{}};", self.export_name);

if let VariantBody::Body {
name: ref variant_name,
Expand Down
3 changes: 3 additions & 0 deletions tests/expectations-symbols/tagged_enum_value_init.c.sym
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
root;
};
12 changes: 6 additions & 6 deletions tests/expectations/annotation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ union F {
Bar_Body bar;

static F Foo(const int16_t &_0) {
F result;
F result{};
::new (&result.foo._0) (int16_t)(_0);
result.tag = Tag::Foo;
return result;
Expand All @@ -66,7 +66,7 @@ union F {

static F Bar(const uint8_t &x,
const int16_t &y) {
F result;
F result{};
::new (&result.bar.x) (uint8_t)(x);
::new (&result.bar.y) (int16_t)(y);
result.tag = Tag::Bar;
Expand All @@ -78,7 +78,7 @@ union F {
}

static F Baz() {
F result;
F result{};
result.tag = Tag::Baz;
return result;
}
Expand Down Expand Up @@ -111,7 +111,7 @@ struct H {
};

static H Hello(const int16_t &_0) {
H result;
H result{};
::new (&result.hello._0) (int16_t)(_0);
result.tag = Tag::Hello;
return result;
Expand All @@ -123,7 +123,7 @@ struct H {

static H There(const uint8_t &x,
const int16_t &y) {
H result;
H result{};
::new (&result.there.x) (uint8_t)(x);
::new (&result.there.y) (int16_t)(y);
result.tag = Tag::There;
Expand All @@ -135,7 +135,7 @@ struct H {
}

static H Everyone() {
H result;
H result{};
result.tag = Tag::Everyone;
return result;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/expectations/array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct Foo {
};

static Foo A(const float (&_0)[20]) {
Foo result;
Foo result{};
for (int i = 0; i < 20; i++) {
::new (&result.a._0[i]) (float)(_0[i]);
}
Expand Down
18 changes: 9 additions & 9 deletions tests/expectations/asserted_cast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct H {
};

static H H_Foo(const int16_t &_0) {
H result;
H result{};
::new (&result.foo._0) (int16_t)(_0);
result.tag = Tag::H_Foo;
return result;
Expand All @@ -55,7 +55,7 @@ struct H {

static H H_Bar(const uint8_t &x,
const int16_t &y) {
H result;
H result{};
::new (&result.bar.x) (uint8_t)(x);
::new (&result.bar.y) (int16_t)(y);
result.tag = Tag::H_Bar;
Expand All @@ -77,7 +77,7 @@ struct H {
}

static H H_Baz() {
H result;
H result{};
result.tag = Tag::H_Baz;
return result;
}
Expand Down Expand Up @@ -110,7 +110,7 @@ struct J {
};

static J J_Foo(const int16_t &_0) {
J result;
J result{};
::new (&result.foo._0) (int16_t)(_0);
result.tag = Tag::J_Foo;
return result;
Expand All @@ -132,7 +132,7 @@ struct J {

static J J_Bar(const uint8_t &x,
const int16_t &y) {
J result;
J result{};
::new (&result.bar.x) (uint8_t)(x);
::new (&result.bar.y) (int16_t)(y);
result.tag = Tag::J_Bar;
Expand All @@ -154,7 +154,7 @@ struct J {
}

static J J_Baz() {
J result;
J result{};
result.tag = Tag::J_Baz;
return result;
}
Expand Down Expand Up @@ -189,7 +189,7 @@ union K {
K_Bar_Body bar;

static K K_Foo(const int16_t &_0) {
K result;
K result{};
::new (&result.foo._0) (int16_t)(_0);
result.tag = Tag::K_Foo;
return result;
Expand All @@ -211,7 +211,7 @@ union K {

static K K_Bar(const uint8_t &x,
const int16_t &y) {
K result;
K result{};
::new (&result.bar.x) (uint8_t)(x);
::new (&result.bar.y) (int16_t)(y);
result.tag = Tag::K_Bar;
Expand All @@ -233,7 +233,7 @@ union K {
}

static K K_Baz() {
K result;
K result{};
result.tag = Tag::K_Baz;
return result;
}
Expand Down
8 changes: 4 additions & 4 deletions tests/expectations/cfg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ union C {
#endif

static C C1() {
C result;
C result{};
result.tag = Tag::C1;
return result;
}
Expand All @@ -157,7 +157,7 @@ union C {
}

static C C2() {
C result;
C result{};
result.tag = Tag::C2;
return result;
}
Expand All @@ -168,7 +168,7 @@ union C {

#if defined(PLATFORM_WIN)
static C C3() {
C result;
C result{};
result.tag = Tag::C3;
return result;
}
Expand All @@ -180,7 +180,7 @@ union C {

#if defined(PLATFORM_UNIX)
static C C5(const int32_t &int_) {
C result;
C result{};
::new (&result.c5.int_) (int32_t)(int_);
result.tag = Tag::C5;
return result;
Expand Down
Loading
Loading