summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml2
-rw-r--r--CONTRIBUTING.md4
-rw-r--r--Cargo.toml2
-rw-r--r--bindgen-integration/Cargo.toml2
-rw-r--r--src/clang.rs9
-rw-r--r--src/codegen/mod.rs2
-rw-r--r--src/ir/comp.rs15
-rw-r--r--src/ir/ty.rs14
-rw-r--r--src/main.rs2
-rw-r--r--tests/expectations/tests/class_nested.rs43
-rw-r--r--tests/expectations/tests/layout_array.rs13
-rw-r--r--tests/expectations/tests/layout_cmdline_token.rs107
-rw-r--r--tests/expectations/tests/layout_mbuf.rs14
-rw-r--r--tests/expectations/tests/struct_containing_forward_declared_struct.rs42
-rw-r--r--tests/expectations/tests/template.rs11
-rw-r--r--tests/headers/class_nested.hpp12
-rw-r--r--tests/tests.rs2
17 files changed, 181 insertions, 115 deletions
diff --git a/.travis.yml b/.travis.yml
index 4dd55c86..ba5ec867 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -15,7 +15,7 @@ rust:
- stable
env:
- - CARGO_TARGET_DIR=/tmp/bindgen LLVM_VERSION=3.8 BINDGEN_FEATURES=llvm_stable
+ - CARGO_TARGET_DIR=/tmp/bindgen LLVM_VERSION=3.8 BINDGEN_FEATURES=testing_only_llvm_stable
- CARGO_TARGET_DIR=/tmp/bindgen LLVM_VERSION=3.9 BINDGEN_FEATURES=
cache:
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 9ee1b4ac..cbaaf3c4 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -69,7 +69,7 @@ that you aren't forgetting to document types and functions. CI will catch it if
you forget, but the turn around will be a lot slower ;)
```
-$ cargo build --features "llvm_stable _docs"
+$ cargo build --features docs_
```
## Testing
@@ -90,7 +90,7 @@ Run `cargo test` to compare generated Rust bindings to the expectations.
### Running All Tests
```
-$ cargo test [--features llvm_stable]
+$ cargo test [--all-features]
```
### Authoring New Tests
diff --git a/Cargo.toml b/Cargo.toml
index c88f949a..a5472af3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -66,7 +66,7 @@ version = "0.29"
[features]
assert_no_dangling_items = []
default = ["logging"]
-llvm_stable = []
+testing_only_llvm_stable = []
logging = ["env_logger", "log"]
static = []
# This feature only exists for CI -- don't use it!
diff --git a/bindgen-integration/Cargo.toml b/bindgen-integration/Cargo.toml
index 9b8e341d..3b1083d4 100644
--- a/bindgen-integration/Cargo.toml
+++ b/bindgen-integration/Cargo.toml
@@ -11,4 +11,4 @@ bindgen = { path = ".." }
gcc = "0.3"
[features]
-llvm_stable = ["bindgen/llvm_stable"]
+testing_only_llvm_stable = ["bindgen/testing_only_llvm_stable"]
diff --git a/src/clang.rs b/src/clang.rs
index 84609ca6..e62ff74c 100644
--- a/src/clang.rs
+++ b/src/clang.rs
@@ -1483,9 +1483,6 @@ pub fn ast_dump(c: &Cursor, depth: isize) -> CXChildVisitResult {
print_cursor(depth,
String::from(prefix) + "referenced.",
&refd);
- print_cursor(depth,
- String::from(prefix) + "referenced.",
- &refd);
}
}
@@ -1495,9 +1492,6 @@ pub fn ast_dump(c: &Cursor, depth: isize) -> CXChildVisitResult {
print_cursor(depth,
String::from(prefix) + "canonical.",
&canonical);
- print_cursor(depth,
- String::from(prefix) + "canonical.",
- &canonical);
}
if let Some(specialized) = c.specialized() {
@@ -1506,9 +1500,6 @@ pub fn ast_dump(c: &Cursor, depth: isize) -> CXChildVisitResult {
print_cursor(depth,
String::from(prefix) + "specialized.",
&specialized);
- print_cursor(depth,
- String::from(prefix) + "specialized.",
- &specialized);
}
}
}
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index 7469abb9..99400f7a 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -2190,7 +2190,7 @@ impl ToRustTy for Type {
.map(|arg| arg.to_rust_ty(ctx))
.collect::<Vec<_>>();
- path.segments.last_mut().unwrap().parameters = if
+ path.segments.last_mut().unwrap().parameters = if
template_args.is_empty() {
None
} else {
diff --git a/src/ir/comp.rs b/src/ir/comp.rs
index b02cd342..7c58e233 100644
--- a/src/ir/comp.rs
+++ b/src/ir/comp.rs
@@ -669,11 +669,20 @@ impl CompInfo {
CXCursor_UnionDecl |
CXCursor_ClassTemplate |
CXCursor_ClassDecl => {
+ // We can find non-semantic children here, clang uses a
+ // StructDecl to note incomplete structs that hasn't been
+ // forward-declared before, see:
+ //
+ // https://github.com/servo/rust-bindgen/issues/482
+ if cur.semantic_parent() != cursor {
+ return CXChildVisit_Continue;
+ }
+
let inner = Item::parse(cur, Some(potential_id), ctx)
.expect("Inner ClassDecl");
- if !ci.inner_types.contains(&inner) {
- ci.inner_types.push(inner);
- }
+
+ ci.inner_types.push(inner);
+
// A declaration of an union or a struct without name could
// also be an unnamed field, unfortunately.
if cur.spelling().is_empty() &&
diff --git a/src/ir/ty.rs b/src/ir/ty.rs
index a98ca446..a47c1470 100644
--- a/src/ir/ty.rs
+++ b/src/ir/ty.rs
@@ -1026,9 +1026,7 @@ impl Type {
CXType_MemberPointer |
CXType_Pointer => {
let inner = Item::from_ty_or_ref(ty.pointee_type().unwrap(),
- location,
- parent_id,
- ctx);
+ location, None, ctx);
TypeKind::Pointer(inner)
}
CXType_BlockPointer => TypeKind::BlockPointer,
@@ -1038,7 +1036,7 @@ impl Type {
CXType_LValueReference => {
let inner = Item::from_ty_or_ref(ty.pointee_type().unwrap(),
location,
- parent_id,
+ None,
ctx);
TypeKind::Reference(inner)
}
@@ -1047,7 +1045,7 @@ impl Type {
CXType_DependentSizedArray => {
let inner = Item::from_ty(ty.elem_type().as_ref().unwrap(),
location,
- parent_id,
+ None,
ctx)
.expect("Not able to resolve array element?");
TypeKind::Pointer(inner)
@@ -1055,7 +1053,7 @@ impl Type {
CXType_IncompleteArray => {
let inner = Item::from_ty(ty.elem_type().as_ref().unwrap(),
location,
- parent_id,
+ None,
ctx)
.expect("Not able to resolve array element?");
TypeKind::Array(inner, 0)
@@ -1070,7 +1068,7 @@ impl Type {
CXType_Typedef => {
let inner = cursor.typedef_type().expect("Not valid Type?");
let inner =
- Item::from_ty_or_ref(inner, location, parent_id, ctx);
+ Item::from_ty_or_ref(inner, location, None, ctx);
TypeKind::Alias(inner)
}
CXType_Enum => {
@@ -1092,7 +1090,7 @@ impl Type {
CXType_ConstantArray => {
let inner = Item::from_ty(ty.elem_type().as_ref().unwrap(),
location,
- parent_id,
+ None,
ctx)
.expect("Not able to resolve array element?");
TypeKind::Array(inner, ty.num_elements().unwrap())
diff --git a/src/main.rs b/src/main.rs
index fc1ef8e2..df596e0b 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -25,7 +25,7 @@ pub fn main() {
let bind_args: Vec<_> = env::args().collect();
let version = clang_version();
- let expected_version = if cfg!(feature = "llvm_stable") {
+ let expected_version = if cfg!(feature = "testing_only_llvm_stable") {
(3, 8)
} else {
(3, 9)
diff --git a/tests/expectations/tests/class_nested.rs b/tests/expectations/tests/class_nested.rs
index 19d70e50..6ddcf91b 100644
--- a/tests/expectations/tests/class_nested.rs
+++ b/tests/expectations/tests/class_nested.rs
@@ -29,6 +29,34 @@ fn bindgen_test_layout_A_B() {
impl Clone for A_B {
fn clone(&self) -> Self { *self }
}
+#[repr(C)]
+#[derive(Debug, Default, Copy)]
+pub struct A_C {
+ pub baz: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_A_C() {
+ assert_eq!(::std::mem::size_of::<A_C>() , 4usize , concat ! (
+ "Size of: " , stringify ! ( A_C ) ));
+ assert_eq! (::std::mem::align_of::<A_C>() , 4usize , concat ! (
+ "Alignment of " , stringify ! ( A_C ) ));
+ assert_eq! (unsafe {
+ & ( * ( 0 as * const A_C ) ) . baz as * const _ as usize } ,
+ 0usize , concat ! (
+ "Alignment of field: " , stringify ! ( A_C ) , "::" ,
+ stringify ! ( baz ) ));
+}
+impl Clone for A_C {
+ fn clone(&self) -> Self { *self }
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct A_D<T> {
+ pub foo: T,
+}
+impl <T> Default for A_D<T> {
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+}
#[test]
fn bindgen_test_layout_A() {
assert_eq!(::std::mem::size_of::<A>() , 4usize , concat ! (
@@ -48,6 +76,21 @@ extern "C" {
#[link_name = "var"]
pub static mut var: A_B;
}
+#[test]
+fn __bindgen_test_layout_template_1() {
+ assert_eq!(::std::mem::size_of::<A_D<::std::os::raw::c_int>>() , 4usize ,
+ concat ! (
+ "Size of template specialization: " , stringify ! (
+ A_D<::std::os::raw::c_int> ) ));
+ assert_eq!(::std::mem::align_of::<A_D<::std::os::raw::c_int>>() , 4usize ,
+ concat ! (
+ "Alignment of template specialization: " , stringify ! (
+ A_D<::std::os::raw::c_int> ) ));
+}
+extern "C" {
+ #[link_name = "baz"]
+ pub static mut baz: A_D<::std::os::raw::c_int>;
+}
#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct D {
diff --git a/tests/expectations/tests/layout_array.rs b/tests/expectations/tests/layout_array.rs
index 3f86cda9..c28d3ec8 100644
--- a/tests/expectations/tests/layout_array.rs
+++ b/tests/expectations/tests/layout_array.rs
@@ -200,11 +200,8 @@ pub struct malloc_heap {
#[repr(C)]
#[derive(Debug, Copy)]
pub struct malloc_heap__bindgen_ty_1 {
- pub lh_first: *mut malloc_heap__bindgen_ty_1_malloc_elem,
+ pub lh_first: *mut malloc_elem,
}
-#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct malloc_heap__bindgen_ty_1_malloc_elem([u8; 0]);
#[test]
fn bindgen_test_layout_malloc_heap__bindgen_ty_1() {
assert_eq!(::std::mem::size_of::<malloc_heap__bindgen_ty_1>() , 8usize ,
@@ -258,3 +255,11 @@ impl Clone for malloc_heap {
impl Default for malloc_heap {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
+#[repr(C)]
+#[derive(Debug, Default, Copy)]
+pub struct malloc_elem {
+ pub _address: u8,
+}
+impl Clone for malloc_elem {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/layout_cmdline_token.rs b/tests/expectations/tests/layout_cmdline_token.rs
index 35127399..791ea9b3 100644
--- a/tests/expectations/tests/layout_cmdline_token.rs
+++ b/tests/expectations/tests/layout_cmdline_token.rs
@@ -11,9 +11,33 @@
#[repr(C)]
#[derive(Debug, Copy)]
pub struct cmdline_token_hdr {
- pub ops: *mut cmdline_token_hdr_cmdline_token_ops,
+ pub ops: *mut cmdline_token_ops,
pub offset: ::std::os::raw::c_uint,
}
+#[test]
+fn bindgen_test_layout_cmdline_token_hdr() {
+ assert_eq!(::std::mem::size_of::<cmdline_token_hdr>() , 16usize , concat !
+ ( "Size of: " , stringify ! ( cmdline_token_hdr ) ));
+ assert_eq! (::std::mem::align_of::<cmdline_token_hdr>() , 8usize , concat
+ ! ( "Alignment of " , stringify ! ( cmdline_token_hdr ) ));
+ assert_eq! (unsafe {
+ & ( * ( 0 as * const cmdline_token_hdr ) ) . ops as * const _
+ as usize } , 0usize , concat ! (
+ "Alignment of field: " , stringify ! ( cmdline_token_hdr ) ,
+ "::" , stringify ! ( ops ) ));
+ assert_eq! (unsafe {
+ & ( * ( 0 as * const cmdline_token_hdr ) ) . offset as * const
+ _ as usize } , 8usize , concat ! (
+ "Alignment of field: " , stringify ! ( cmdline_token_hdr ) ,
+ "::" , stringify ! ( offset ) ));
+}
+impl Clone for cmdline_token_hdr {
+ fn clone(&self) -> Self { *self }
+}
+impl Default for cmdline_token_hdr {
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+}
+pub type cmdline_parse_token_hdr_t = cmdline_token_hdr;
/**
* A token is defined by this structure.
*
@@ -35,7 +59,7 @@ pub struct cmdline_token_hdr {
*/
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct cmdline_token_hdr_cmdline_token_ops {
+pub struct cmdline_token_ops {
/** parse(token ptr, buf, res pts, buf len) */
pub parse: ::std::option::Option<unsafe extern "C" fn(arg1:
*mut cmdline_parse_token_hdr_t,
@@ -70,71 +94,38 @@ pub struct cmdline_token_hdr_cmdline_token_ops {
-> ::std::os::raw::c_int>,
}
#[test]
-fn bindgen_test_layout_cmdline_token_hdr_cmdline_token_ops() {
- assert_eq!(::std::mem::size_of::<cmdline_token_hdr_cmdline_token_ops>() ,
- 32usize , concat ! (
- "Size of: " , stringify ! ( cmdline_token_hdr_cmdline_token_ops
- ) ));
- assert_eq! (::std::mem::align_of::<cmdline_token_hdr_cmdline_token_ops>()
- , 8usize , concat ! (
- "Alignment of " , stringify ! (
- cmdline_token_hdr_cmdline_token_ops ) ));
+fn bindgen_test_layout_cmdline_token_ops() {
+ assert_eq!(::std::mem::size_of::<cmdline_token_ops>() , 32usize , concat !
+ ( "Size of: " , stringify ! ( cmdline_token_ops ) ));
+ assert_eq! (::std::mem::align_of::<cmdline_token_ops>() , 8usize , concat
+ ! ( "Alignment of " , stringify ! ( cmdline_token_ops ) ));
assert_eq! (unsafe {
- & ( * ( 0 as * const cmdline_token_hdr_cmdline_token_ops ) ) .
- parse as * const _ as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! (
- cmdline_token_hdr_cmdline_token_ops ) , "::" , stringify ! (
- parse ) ));
+ & ( * ( 0 as * const cmdline_token_ops ) ) . parse as * const
+ _ as usize } , 0usize , concat ! (
+ "Alignment of field: " , stringify ! ( cmdline_token_ops ) ,
+ "::" , stringify ! ( parse ) ));
assert_eq! (unsafe {
- & ( * ( 0 as * const cmdline_token_hdr_cmdline_token_ops ) ) .
- complete_get_nb as * const _ as usize } , 8usize , concat ! (
- "Alignment of field: " , stringify ! (
- cmdline_token_hdr_cmdline_token_ops ) , "::" , stringify ! (
- complete_get_nb ) ));
+ & ( * ( 0 as * const cmdline_token_ops ) ) . complete_get_nb
+ as * const _ as usize } , 8usize , concat ! (
+ "Alignment of field: " , stringify ! ( cmdline_token_ops ) ,
+ "::" , stringify ! ( complete_get_nb ) ));
assert_eq! (unsafe {
- & ( * ( 0 as * const cmdline_token_hdr_cmdline_token_ops ) ) .
- complete_get_elt as * const _ as usize } , 16usize , concat !
- (
- "Alignment of field: " , stringify ! (
- cmdline_token_hdr_cmdline_token_ops ) , "::" , stringify ! (
- complete_get_elt ) ));
+ & ( * ( 0 as * const cmdline_token_ops ) ) . complete_get_elt
+ as * const _ as usize } , 16usize , concat ! (
+ "Alignment of field: " , stringify ! ( cmdline_token_ops ) ,
+ "::" , stringify ! ( complete_get_elt ) ));
assert_eq! (unsafe {
- & ( * ( 0 as * const cmdline_token_hdr_cmdline_token_ops ) ) .
- get_help as * const _ as usize } , 24usize , concat ! (
- "Alignment of field: " , stringify ! (
- cmdline_token_hdr_cmdline_token_ops ) , "::" , stringify ! (
- get_help ) ));
+ & ( * ( 0 as * const cmdline_token_ops ) ) . get_help as *
+ const _ as usize } , 24usize , concat ! (
+ "Alignment of field: " , stringify ! ( cmdline_token_ops ) ,
+ "::" , stringify ! ( get_help ) ));
}
-impl Clone for cmdline_token_hdr_cmdline_token_ops {
+impl Clone for cmdline_token_ops {
fn clone(&self) -> Self { *self }
}
-impl Default for cmdline_token_hdr_cmdline_token_ops {
+impl Default for cmdline_token_ops {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
-#[test]
-fn bindgen_test_layout_cmdline_token_hdr() {
- assert_eq!(::std::mem::size_of::<cmdline_token_hdr>() , 16usize , concat !
- ( "Size of: " , stringify ! ( cmdline_token_hdr ) ));
- assert_eq! (::std::mem::align_of::<cmdline_token_hdr>() , 8usize , concat
- ! ( "Alignment of " , stringify ! ( cmdline_token_hdr ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const cmdline_token_hdr ) ) . ops as * const _
- as usize } , 0usize , concat ! (
- "Alignment of field: " , stringify ! ( cmdline_token_hdr ) ,
- "::" , stringify ! ( ops ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const cmdline_token_hdr ) ) . offset as * const
- _ as usize } , 8usize , concat ! (
- "Alignment of field: " , stringify ! ( cmdline_token_hdr ) ,
- "::" , stringify ! ( offset ) ));
-}
-impl Clone for cmdline_token_hdr {
- fn clone(&self) -> Self { *self }
-}
-impl Default for cmdline_token_hdr {
- fn default() -> Self { unsafe { ::std::mem::zeroed() } }
-}
-pub type cmdline_parse_token_hdr_t = cmdline_token_hdr;
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum cmdline_numtype {
diff --git a/tests/expectations/tests/layout_mbuf.rs b/tests/expectations/tests/layout_mbuf.rs
index c0c2cce2..189b50a5 100644
--- a/tests/expectations/tests/layout_mbuf.rs
+++ b/tests/expectations/tests/layout_mbuf.rs
@@ -98,7 +98,7 @@ pub struct rte_mbuf {
pub cacheline1: MARKER,
pub __bindgen_anon_3: rte_mbuf__bindgen_ty_4,
/**< Pool from which mbuf was allocated. */
- pub pool: *mut rte_mbuf_rte_mempool,
+ pub pool: *mut rte_mempool,
/**< Next segment of scattered packet. */
pub next: *mut rte_mbuf,
pub __bindgen_anon_4: rte_mbuf__bindgen_ty_5,
@@ -490,9 +490,6 @@ impl Clone for rte_mbuf__bindgen_ty_4 {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-#[derive(Debug, Copy, Clone)]
-pub struct rte_mbuf_rte_mempool([u8; 0]);
-#[repr(C)]
#[derive(Debug, Default, Copy)]
pub struct rte_mbuf__bindgen_ty_5 {
/**< combined for easy fetch */
@@ -734,3 +731,12 @@ impl Clone for rte_mbuf {
impl Default for rte_mbuf {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
+/**< Pool from which mbuf was allocated. */
+#[repr(C)]
+#[derive(Debug, Default, Copy)]
+pub struct rte_mempool {
+ pub _address: u8,
+}
+impl Clone for rte_mempool {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/struct_containing_forward_declared_struct.rs b/tests/expectations/tests/struct_containing_forward_declared_struct.rs
index ff16490a..58ab04c9 100644
--- a/tests/expectations/tests/struct_containing_forward_declared_struct.rs
+++ b/tests/expectations/tests/struct_containing_forward_declared_struct.rs
@@ -7,27 +7,7 @@
#[repr(C)]
#[derive(Debug, Copy)]
pub struct a {
- pub val_a: *mut a_b,
-}
-#[repr(C)]
-#[derive(Debug, Default, Copy)]
-pub struct a_b {
- pub val_b: ::std::os::raw::c_int,
-}
-#[test]
-fn bindgen_test_layout_a_b() {
- assert_eq!(::std::mem::size_of::<a_b>() , 4usize , concat ! (
- "Size of: " , stringify ! ( a_b ) ));
- assert_eq! (::std::mem::align_of::<a_b>() , 4usize , concat ! (
- "Alignment of " , stringify ! ( a_b ) ));
- assert_eq! (unsafe {
- & ( * ( 0 as * const a_b ) ) . val_b as * const _ as usize } ,
- 0usize , concat ! (
- "Alignment of field: " , stringify ! ( a_b ) , "::" ,
- stringify ! ( val_b ) ));
-}
-impl Clone for a_b {
- fn clone(&self) -> Self { *self }
+ pub val_a: *mut b,
}
#[test]
fn bindgen_test_layout_a() {
@@ -47,3 +27,23 @@ impl Clone for a {
impl Default for a {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
+#[repr(C)]
+#[derive(Debug, Default, Copy)]
+pub struct b {
+ pub val_b: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_b() {
+ assert_eq!(::std::mem::size_of::<b>() , 4usize , concat ! (
+ "Size of: " , stringify ! ( b ) ));
+ assert_eq! (::std::mem::align_of::<b>() , 4usize , concat ! (
+ "Alignment of " , stringify ! ( b ) ));
+ assert_eq! (unsafe {
+ & ( * ( 0 as * const b ) ) . val_b as * const _ as usize } ,
+ 0usize , concat ! (
+ "Alignment of field: " , stringify ! ( b ) , "::" , stringify
+ ! ( val_b ) ));
+}
+impl Clone for b {
+ fn clone(&self) -> Self { *self }
+}
diff --git a/tests/expectations/tests/template.rs b/tests/expectations/tests/template.rs
index 131a54fd..3c829f07 100644
--- a/tests/expectations/tests/template.rs
+++ b/tests/expectations/tests/template.rs
@@ -258,6 +258,17 @@ fn __bindgen_test_layout_template_1() {
}
#[test]
fn __bindgen_test_layout_template_2() {
+ assert_eq!(::std::mem::size_of::<Rooted<*mut ::std::os::raw::c_void>>() ,
+ 24usize , concat ! (
+ "Size of template specialization: " , stringify ! (
+ Rooted<*mut ::std::os::raw::c_void> ) ));
+ assert_eq!(::std::mem::align_of::<Rooted<*mut ::std::os::raw::c_void>>() ,
+ 8usize , concat ! (
+ "Alignment of template specialization: " , stringify ! (
+ Rooted<*mut ::std::os::raw::c_void> ) ));
+}
+#[test]
+fn __bindgen_test_layout_template_3() {
assert_eq!(::std::mem::size_of::<WithDtor<::std::os::raw::c_int>>() ,
4usize , concat ! (
"Size of template specialization: " , stringify ! (
diff --git a/tests/headers/class_nested.hpp b/tests/headers/class_nested.hpp
index ab38d500..ccf2f895 100644
--- a/tests/headers/class_nested.hpp
+++ b/tests/headers/class_nested.hpp
@@ -4,9 +4,21 @@ public:
class B {
int member_b;
};
+
+ class C;
+
+ template<typename T>
+ class D {
+ T foo;
+ };
+};
+
+class A::C {
+ int baz;
};
A::B var;
+A::D<int> baz;
class D {
A::B member;
diff --git a/tests/tests.rs b/tests/tests.rs
index ab1c00c3..6b69e0d4 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -84,7 +84,7 @@ fn create_bindgen_builder(header: &PathBuf) -> Result<Option<Builder>, Error> {
.unwrap();
flags.extend(extra_flags.into_iter());
} else if line.contains("bindgen-unstable") &&
- cfg!(feature = "llvm_stable") {
+ cfg!(feature = "testing_only_llvm_stable") {
return Ok(None);
} else if line.contains("bindgen-osx-only") {
let prepend_flags = ["--raw-line", "#![cfg(target_os=\"macos\")]"];