summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <ecoal95@gmail.com>2016-10-22 02:46:14 +0200
committerEmilio Cobos Álvarez <ecoal95@gmail.com>2016-10-29 22:25:20 +0200
commitfe3f530a38deda4265cf1bfc8a4880cded7afade (patch)
treebb90a4fbf26cc9cab46e7a7a661cdf140bf0acb3
parent801179c198d0870e207f49c91d7aa491be615710 (diff)
ty: Don't bailout if we don't have any template type in the aliased template parameter case.
-rw-r--r--src/ir/ty.rs16
-rw-r--r--tests/expectations/empty_template_param_name.rs1
2 files changed, 12 insertions, 5 deletions
diff --git a/src/ir/ty.rs b/src/ir/ty.rs
index a883ea66..09059528 100644
--- a/src/ir/ty.rs
+++ b/src/ir/ty.rs
@@ -566,11 +566,17 @@ impl Type {
return Err(ParseError::Continue);
}
- if args.is_empty() {
- error!("Failed to get any template parameter, maybe a specialization? {:?}", location);
- return Err(ParseError::Continue);
- }
-
+ // NB: `args` may be empty here (if for example the
+ // template parameters are constants).
+ //
+ // We can't reject it here then because inner points
+ // to `potential_id` now, so either we remove
+ // `inner` and return an error, or carry on.
+ //
+ // In this case, we just carry on, since it seems
+ // easier if than removing every possible reference
+ // to `item` from `ctx`, and it doesn't give any
+ // problems that we didn't have anyway.
TypeKind::TemplateAlias(inner.unwrap(), args)
}
CXCursor_TemplateRef => {
diff --git a/tests/expectations/empty_template_param_name.rs b/tests/expectations/empty_template_param_name.rs
index d165df80..e10b56db 100644
--- a/tests/expectations/empty_template_param_name.rs
+++ b/tests/expectations/empty_template_param_name.rs
@@ -4,6 +4,7 @@
#![allow(non_snake_case)]
+pub type __void_t = ::std::os::raw::c_void;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __iterator_traits<_Iterator> {