File tree 3 files changed +21
-8
lines changed
3 files changed +21
-8
lines changed Original file line number Diff line number Diff line change @@ -184,7 +184,7 @@ impl<'ctx> BindgenContext<'ctx> {
184
184
& options. clang_args ,
185
185
& [ ] ,
186
186
parse_options)
187
- . expect ( "TranslationUnit::parse" ) ;
187
+ . expect ( "TranslationUnit::parse failed " ) ;
188
188
189
189
let root_module = Self :: build_root_module ( ItemId ( 0 ) ) ;
190
190
let mut me = BindgenContext {
Original file line number Diff line number Diff line change @@ -91,12 +91,13 @@ impl TemplateInstantiation {
91
91
-> TemplateInstantiation {
92
92
use clang_sys:: * ;
93
93
94
- let template_args: Vec < _ > = ty. template_args ( )
95
- . expect ( "If there weren't template args, then you shouldn't have \
96
- tried to instantiate a template!")
97
- . filter ( |t| t. kind ( ) != CXType_Invalid )
98
- . map ( |t| Item :: from_ty_or_ref ( t, t. declaration ( ) , None , ctx) )
99
- . collect ( ) ;
94
+ let template_args = ty. template_args ( )
95
+ . map ( |args| {
96
+ args. filter ( |t| t. kind ( ) != CXType_Invalid )
97
+ . map ( |t| Item :: from_ty_or_ref ( t, t. declaration ( ) , None , ctx) )
98
+ . collect ( )
99
+ } )
100
+ . unwrap_or ( vec ! [ ] ) ;
100
101
101
102
let definition = ty. declaration ( )
102
103
. specialized ( )
@@ -108,7 +109,11 @@ impl TemplateInstantiation {
108
109
return CXVisit_Break ;
109
110
}
110
111
111
- CXVisit_Continue
112
+ // Instantiations of template aliases might have the
113
+ // TemplateRef to the template alias definition arbitrarily
114
+ // deep, so we need to recurse here and not only visit
115
+ // direct children.
116
+ CXChildVisit_Recurse
112
117
} ) ;
113
118
114
119
template_ref. and_then ( |cur| cur. referenced ( ) )
Original file line number Diff line number Diff line change
1
+ // bindgen-flags: -- -std=c++14
2
+
3
+ template <typename T>
4
+ struct Foo {
5
+ template <typename > using FirstAlias = typename T::Associated;
6
+ template <typename U> using SecondAlias = Foo<FirstAlias<U>>;
7
+ SecondAlias<int > member;
8
+ };
You can’t perform that action at this time.
0 commit comments