From fe3f530a38deda4265cf1bfc8a4880cded7afade Mon Sep 17 00:00:00 2001 From: Emilio Cobos Álvarez Date: Sat, 22 Oct 2016 02:46:14 +0200 Subject: ty: Don't bailout if we don't have any template type in the aliased template parameter case. --- src/ir/ty.rs | 16 +++++++++++----- tests/expectations/empty_template_param_name.rs | 1 + 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> { -- cgit v1.2.3