Skip to content

Commit fe3f530

Browse files
committed
ty: Don't bailout if we don't have any template type in the aliased template parameter case.
1 parent 801179c commit fe3f530

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/ir/ty.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -566,11 +566,17 @@ impl Type {
566566
return Err(ParseError::Continue);
567567
}
568568

569-
if args.is_empty() {
570-
error!("Failed to get any template parameter, maybe a specialization? {:?}", location);
571-
return Err(ParseError::Continue);
572-
}
573-
569+
// NB: `args` may be empty here (if for example the
570+
// template parameters are constants).
571+
//
572+
// We can't reject it here then because inner points
573+
// to `potential_id` now, so either we remove
574+
// `inner` and return an error, or carry on.
575+
//
576+
// In this case, we just carry on, since it seems
577+
// easier if than removing every possible reference
578+
// to `item` from `ctx`, and it doesn't give any
579+
// problems that we didn't have anyway.
574580
TypeKind::TemplateAlias(inner.unwrap(), args)
575581
}
576582
CXCursor_TemplateRef => {

tests/expectations/empty_template_param_name.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#![allow(non_snake_case)]
55

66

7+
pub type __void_t = ::std::os::raw::c_void;
78
#[repr(C)]
89
#[derive(Debug, Copy, Clone)]
910
pub struct __iterator_traits<_Iterator> {

0 commit comments

Comments
 (0)