diff options
author | Emilio Cobos Álvarez <ecoal95@gmail.com> | 2016-11-02 22:54:32 +0100 |
---|---|---|
committer | Emilio Cobos Álvarez <ecoal95@gmail.com> | 2016-11-02 23:10:15 +0100 |
commit | ef59d9ed1eeb45494a183c6363069ec492969b34 (patch) | |
tree | 37c9e49de4af97a8729bad38f3660259216e5a98 /src | |
parent | 6b303852f4a923e809c688dc5ab86c466f2901ae (diff) |
clang: Some partially specialized templates return no template argument count.
Diffstat (limited to 'src')
-rwxr-xr-x | src/clang.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/clang.rs b/src/clang.rs index bc3d511f..b58cf017 100755 --- a/src/clang.rs +++ b/src/clang.rs @@ -131,6 +131,9 @@ impl Cursor { /// Return the number of template arguments used by this cursor's referent, /// if the referent is either a template specialization or /// declaration. Returns -1 otherwise. + /// + /// NOTE: This may not return `Some` for some non-fully specialized + /// templates, see #193 and #194. pub fn num_template_args(&self) -> Option<u32> { let n: c_int = unsafe { clang_Cursor_getNumTemplateArguments(self.x) }; @@ -193,7 +196,7 @@ impl Cursor { /// Is the referent a fully specialized template specialization without any /// remaining free template arguments? pub fn is_fully_specialized_template(&self) -> bool { - self.is_template() && self.num_template_args().unwrap() > 0 + self.is_template() && self.num_template_args().unwrap_or(0) > 0 } /// Is the referent a template specialization that still has remaining free |