Auto merge of #692 - emilio:virtual-template-params, r=fitzgen

ir: Don't assume template instantiation argument with vtable implies vtable

Fixes #691
diff --git a/Cargo.lock b/Cargo.lock
index 53148b4..857ef01 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1,6 +1,6 @@
 [root]
 name = "bindgen"
-version = "0.24.0"
+version = "0.24.1"
 dependencies = [
  "aster 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "cexpr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/Cargo.toml b/Cargo.toml
index 831a375..33c1a22 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@
 readme = "README.md"
 repository = "https://github.com/servo/rust-bindgen"
 documentation = "https://docs.rs/bindgen"
-version = "0.24.0"
+version = "0.24.1"
 build = "build.rs"
 
 exclude = [
diff --git a/src/ir/template.rs b/src/ir/template.rs
index d299633..5861929 100644
--- a/src/ir/template.rs
+++ b/src/ir/template.rs
@@ -279,8 +279,7 @@
 
     /// Does this instantiation have a vtable?
     pub fn has_vtable(&self, ctx: &BindgenContext) -> bool {
-        ctx.resolve_type(self.definition).has_vtable(ctx) ||
-        self.args.iter().any(|arg| ctx.resolve_type(*arg).has_vtable(ctx))
+        ctx.resolve_type(self.definition).has_vtable(ctx)
     }
 
     /// Does this instantiation have a destructor?
diff --git a/tests/expectations/tests/issue-691-template-parameter-virtual.rs b/tests/expectations/tests/issue-691-template-parameter-virtual.rs
new file mode 100644
index 0000000..8333f1f
--- /dev/null
+++ b/tests/expectations/tests/issue-691-template-parameter-virtual.rs
@@ -0,0 +1,60 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+pub struct VirtualMethods__bindgen_vtable(::std::os::raw::c_void);
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct VirtualMethods {
+    pub vtable_: *const VirtualMethods__bindgen_vtable,
+}
+#[test]
+fn bindgen_test_layout_VirtualMethods() {
+    assert_eq!(::std::mem::size_of::<VirtualMethods>() , 8usize , concat ! (
+               "Size of: " , stringify ! ( VirtualMethods ) ));
+    assert_eq! (::std::mem::align_of::<VirtualMethods>() , 8usize , concat ! (
+                "Alignment of " , stringify ! ( VirtualMethods ) ));
+}
+impl Clone for VirtualMethods {
+    fn clone(&self) -> Self { *self }
+}
+impl Default for VirtualMethods {
+    fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+}
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone)]
+pub struct Set {
+    pub bar: ::std::os::raw::c_int,
+}
+#[repr(C)]
+#[derive(Debug, Copy)]
+pub struct ServoElementSnapshotTable {
+    pub _base: Set,
+}
+#[test]
+fn bindgen_test_layout_ServoElementSnapshotTable() {
+    assert_eq!(::std::mem::size_of::<ServoElementSnapshotTable>() , 4usize ,
+               concat ! (
+               "Size of: " , stringify ! ( ServoElementSnapshotTable ) ));
+    assert_eq! (::std::mem::align_of::<ServoElementSnapshotTable>() , 4usize ,
+                concat ! (
+                "Alignment of " , stringify ! ( ServoElementSnapshotTable )
+                ));
+}
+impl Clone for ServoElementSnapshotTable {
+    fn clone(&self) -> Self { *self }
+}
+impl Default for ServoElementSnapshotTable {
+    fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+}
+#[test]
+fn __bindgen_test_layout_Set_instantiation_13() {
+    assert_eq!(::std::mem::size_of::<Set>() , 4usize , concat ! (
+               "Size of template specialization: " , stringify ! ( Set ) ));
+    assert_eq!(::std::mem::align_of::<Set>() , 4usize , concat ! (
+               "Alignment of template specialization: " , stringify ! ( Set )
+               ));
+}
diff --git a/tests/headers/issue-691-template-parameter-virtual.hpp b/tests/headers/issue-691-template-parameter-virtual.hpp
new file mode 100644
index 0000000..f80e058
--- /dev/null
+++ b/tests/headers/issue-691-template-parameter-virtual.hpp
@@ -0,0 +1,12 @@
+class VirtualMethods {
+  virtual void foo();
+};
+
+template<typename K>
+class Set {
+  int bar;
+};
+
+class ServoElementSnapshotTable
+  : public Set<VirtualMethods>
+{};