summaryrefslogtreecommitdiff
path: root/libbindgen/tests
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2016-12-28 11:16:14 +0100
committerEmilio Cobos Álvarez <emilio@crisal.io>2016-12-28 11:24:06 +0100
commitf7a328a2406e98d93a10453c613f675ce51471a9 (patch)
treecc3ec43bcb2c1ca9a7a160711efec5f3658a8a73 /libbindgen/tests
parentba1cb0a005cae7b7eac48673d1af317f181325b1 (diff)
ir: More generic handling of non-deductible auto types.
Diffstat (limited to 'libbindgen/tests')
-rw-r--r--libbindgen/tests/expectations/tests/auto.rs12
-rw-r--r--libbindgen/tests/expectations/tests/template_function_with_auto.rs10
-rw-r--r--libbindgen/tests/headers/auto.hpp17
-rw-r--r--libbindgen/tests/headers/template_function_with_auto.hpp9
4 files changed, 26 insertions, 22 deletions
diff --git a/libbindgen/tests/expectations/tests/auto.rs b/libbindgen/tests/expectations/tests/auto.rs
index e35f5ed2..6224e807 100644
--- a/libbindgen/tests/expectations/tests/auto.rs
+++ b/libbindgen/tests/expectations/tests/auto.rs
@@ -9,7 +9,7 @@
pub struct Foo {
pub _address: u8,
}
-pub const Foo_kBar: bool = true;
+pub const Foo_kFoo: bool = true;
#[test]
fn bindgen_test_layout_Foo() {
assert_eq!(::std::mem::size_of::<Foo>() , 1usize);
@@ -18,3 +18,13 @@ fn bindgen_test_layout_Foo() {
impl Clone for Foo {
fn clone(&self) -> Self { *self }
}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct Bar<T> {
+ pub _address: u8,
+ pub _phantom_0: ::std::marker::PhantomData<T>,
+}
+extern "C" {
+ #[link_name = "_Z5Test2v"]
+ pub fn Test2() -> ::std::os::raw::c_uint;
+}
diff --git a/libbindgen/tests/expectations/tests/template_function_with_auto.rs b/libbindgen/tests/expectations/tests/template_function_with_auto.rs
deleted file mode 100644
index b86d8224..00000000
--- a/libbindgen/tests/expectations/tests/template_function_with_auto.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-/* automatically generated by rust-bindgen */
-
-
-#![allow(non_snake_case)]
-
-
-extern "C" {
- #[link_name = "_Z5Test2v"]
- pub fn Test2() -> ::std::os::raw::c_uint;
-}
diff --git a/libbindgen/tests/headers/auto.hpp b/libbindgen/tests/headers/auto.hpp
index 64025295..b5f6d5f3 100644
--- a/libbindgen/tests/headers/auto.hpp
+++ b/libbindgen/tests/headers/auto.hpp
@@ -1,6 +1,19 @@
-// bindgen-flags: -- -std=c++11
+// bindgen-flags: -- -std=c++14
// bindgen-unstable
class Foo {
- static constexpr auto kBar = 2 == 2;
+ static constexpr auto kFoo = 2 == 2;
};
+
+template<typename T>
+class Bar {
+ static const constexpr auto kBar = T(1);
+};
+
+template<typename T> auto Test1() {
+ return T(1);
+}
+
+auto Test2() {
+ return Test1<unsigned int>();
+}
diff --git a/libbindgen/tests/headers/template_function_with_auto.hpp b/libbindgen/tests/headers/template_function_with_auto.hpp
deleted file mode 100644
index 3bd4a64f..00000000
--- a/libbindgen/tests/headers/template_function_with_auto.hpp
+++ /dev/null
@@ -1,9 +0,0 @@
-// bindgen-flags: -- -std=c++14
-
-template<typename T> auto Test1() {
- return T(1);
-}
-
-auto Test2() {
- return Test1<unsigned int>();
-}