Skip to content

Commit 587b54c

Browse files
committed
ty: Don't bailout if we don't have any template type in the aliased template parameter case.
1 parent 5e99041 commit 587b54c

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
@@ -521,11 +521,17 @@ impl Type {
521521
return Err(ParseError::Continue);
522522
}
523523

524-
if args.is_empty() {
525-
error!("Failed to get any template parameter, maybe a specialization? {:?}", location);
526-
return Err(ParseError::Continue);
527-
}
528-
524+
// NB: `args` may be empty here (if for example the
525+
// template parameters are constants).
526+
//
527+
// We can't reject it here then because inner points
528+
// to `potential_id` now, so either we remove
529+
// `inner` and return an error, or carry on.
530+
//
531+
// In this case, we just carry on, since it seems
532+
// easier if than removing every possible reference
533+
// to `item` from `ctx`, and it doesn't give any
534+
// problems that we didn't have anyway.
529535
TypeKind::TemplateAlias(inner.unwrap(), args)
530536
}
531537
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)