Skip to content

Commit fad1b50

Browse files
committed
Add test of enum and typedef with same name
error[E0428]: the name `Enum` is defined multiple times --> bindgen-tests/tests/expectations/tests/enum-typedef.rs:10:1 | 9 | pub type Enum = ::std::os::raw::c_uint; | --------------------------------------- previous definition of the type `Enum` here 10 | pub type Enum = i16; | ^^^^^^^^^^^^^^^^^^^^ `Enum` redefined here | = note: `Enum` must be defined only once in the type namespace of this module error[E0428]: the name `TypedefFirst` is defined multiple times --> bindgen-tests/tests/expectations/tests/enum-typedef.rs:13:1 | 11 | pub type TypedefFirst = i16; | ---------------------------- previous definition of the type `TypedefFirst` here 12 | pub const TypedefFirst_Variant2: TypedefFirst = 0; 13 | pub type TypedefFirst = ::std::os::raw::c_uint; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `TypedefFirst` redefined here | = note: `TypedefFirst` must be defined only once in the type namespace of this module
1 parent 95fd17b commit fad1b50

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

bindgen-tests/tests/expectations/tests/enum-typedef.rs

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
typedef short int16_t;
2+
3+
// `cbindgen` emits this C idiom as the translation of:
4+
//
5+
// #[repr(i16)]
6+
// pub enum Enum {
7+
// Variant,
8+
// }
9+
enum Enum {
10+
Variant,
11+
};
12+
typedef int16_t Enum;
13+
14+
// C is also fine with the typedef coming before the enum.
15+
typedef int16_t TypedefFirst;
16+
enum TypedefFirst {
17+
Variant2,
18+
};

0 commit comments

Comments
 (0)