summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbindgen/src/ir/ty.rs9
-rw-r--r--libbindgen/tests/expectations/tests/auto.rs20
-rw-r--r--libbindgen/tests/headers/auto.hpp6
3 files changed, 35 insertions, 0 deletions
diff --git a/libbindgen/src/ir/ty.rs b/libbindgen/src/ir/ty.rs
index 3d379969..ada3d9b1 100644
--- a/libbindgen/src/ir/ty.rs
+++ b/libbindgen/src/ir/ty.rs
@@ -780,6 +780,15 @@ impl Type {
return Err(ParseError::Continue);
}
}
+ CXType_Auto => {
+ // We don't want to blow the stack.
+ assert!(canonical_ty != *ty, "Couldn't find deduced type");
+ return Self::from_clang_ty(potential_id,
+ &canonical_ty,
+ location,
+ parent_id,
+ ctx);
+ }
// NOTE: We don't resolve pointers eagerly because the pointee type
// might not have been parsed, and if it contains templates or
// something else we might get confused, see the comment inside
diff --git a/libbindgen/tests/expectations/tests/auto.rs b/libbindgen/tests/expectations/tests/auto.rs
new file mode 100644
index 00000000..e35f5ed2
--- /dev/null
+++ b/libbindgen/tests/expectations/tests/auto.rs
@@ -0,0 +1,20 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct Foo {
+ pub _address: u8,
+}
+pub const Foo_kBar: bool = true;
+#[test]
+fn bindgen_test_layout_Foo() {
+ assert_eq!(::std::mem::size_of::<Foo>() , 1usize);
+ assert_eq!(::std::mem::align_of::<Foo>() , 1usize);
+}
+impl Clone for Foo {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/libbindgen/tests/headers/auto.hpp b/libbindgen/tests/headers/auto.hpp
new file mode 100644
index 00000000..64025295
--- /dev/null
+++ b/libbindgen/tests/headers/auto.hpp
@@ -0,0 +1,6 @@
+// bindgen-flags: -- -std=c++11
+// bindgen-unstable
+
+class Foo {
+ static constexpr auto kBar = 2 == 2;
+};