Skip to content

Commit 912abe5

Browse files
committed
ir: Skip function template earlier.
This should fix rust-lang#364.
1 parent 3ba3a76 commit 912abe5

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed

libbindgen/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ license = "BSD-3-Clause"
1212
name = "libbindgen"
1313
readme = "README.md"
1414
repository = "https://github.com/servo/rust-bindgen"
15-
version = "0.1.4"
15+
version = "0.1.5"
1616
workspace = ".."
1717

1818
[dev-dependencies]

libbindgen/src/ir/function.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ impl FunctionSig {
134134
use clang_sys::*;
135135
debug!("FunctionSig::from_ty {:?} {:?}", ty, cursor);
136136

137+
// Skip function templates
138+
if cursor.kind() == CXCursor_FunctionTemplate {
139+
return Err(ParseError::Continue);
140+
}
141+
137142
// Don't parse operatorxx functions in C++
138143
let spelling = cursor.spelling();
139144
if spelling.starts_with("operator") {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* automatically generated by rust-bindgen */
2+
3+
4+
#![allow(non_snake_case)]
5+
6+
7+
extern "C" {
8+
#[link_name = "_Z5Test2v"]
9+
pub fn Test2() -> ::std::os::raw::c_uint;
10+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// bindgen-flags: -- -std=c++14
2+
3+
template<typename T> auto Test1() {
4+
return T(1);
5+
}
6+
7+
auto Test2() {
8+
return Test1<unsigned int>();
9+
}

0 commit comments

Comments
 (0)