summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ir/named.rs4
-rw-r--r--tests/expectations/tests/issue-638-stylo-cannot-find-T-in-this-scope.rs23
-rw-r--r--tests/headers/issue-638-stylo-cannot-find-T-in-this-scope.hpp12
3 files changed, 39 insertions, 0 deletions
diff --git a/src/ir/named.rs b/src/ir/named.rs
index 39fa2201..17f46eca 100644
--- a/src/ir/named.rs
+++ b/src/ir/named.rs
@@ -481,6 +481,10 @@ impl<'ctx, 'gen> MonotoneFramework for UsedTemplateParameters<'ctx, 'gen> {
if used_by_def.contains(param) {
debug!(" param is used by template definition");
+ let arg = arg.into_resolver()
+ .through_type_refs()
+ .through_type_aliases()
+ .resolve(self.ctx);
if let Some(named) = arg.as_named(self.ctx, &()) {
debug!(" arg is a type parameter, marking used");
used_by_this_id.insert(named);
diff --git a/tests/expectations/tests/issue-638-stylo-cannot-find-T-in-this-scope.rs b/tests/expectations/tests/issue-638-stylo-cannot-find-T-in-this-scope.rs
new file mode 100644
index 00000000..4ff0b5bc
--- /dev/null
+++ b/tests/expectations/tests/issue-638-stylo-cannot-find-T-in-this-scope.rs
@@ -0,0 +1,23 @@
+/* automatically generated by rust-bindgen */
+
+
+#![allow(non_snake_case)]
+
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct RefPtr<T> {
+ pub use_of_t: T,
+}
+impl <T> Default for RefPtr<T> {
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct UsesRefPtrWithAliasedTypeParam<U> {
+ pub member: RefPtr<UsesRefPtrWithAliasedTypeParam_V<U>>,
+}
+pub type UsesRefPtrWithAliasedTypeParam_V<U> = U;
+impl <U> Default for UsesRefPtrWithAliasedTypeParam<U> {
+ fn default() -> Self { unsafe { ::std::mem::zeroed() } }
+}
diff --git a/tests/headers/issue-638-stylo-cannot-find-T-in-this-scope.hpp b/tests/headers/issue-638-stylo-cannot-find-T-in-this-scope.hpp
new file mode 100644
index 00000000..13b656e1
--- /dev/null
+++ b/tests/headers/issue-638-stylo-cannot-find-T-in-this-scope.hpp
@@ -0,0 +1,12 @@
+// bindgen-flags: -- -std=c++14
+
+template <class T>
+class RefPtr {
+ T use_of_t;
+};
+
+template <typename U>
+class UsesRefPtrWithAliasedTypeParam {
+ using V = U;
+ RefPtr<V> member;
+};