@@ -30,7 +30,7 @@ public MultipleInheritancePass()
3030 public override bool VisitTranslationUnit ( TranslationUnit unit )
3131 {
3232 bool result = base . VisitTranslationUnit ( unit ) ;
33- foreach ( var @interface in interfaces )
33+ foreach ( var @interface in interfaces . Where ( i => ! ( i . Key is ClassTemplateSpecialization ) ) )
3434 @interface . Key . Namespace . Classes . Add ( @interface . Value ) ;
3535 interfaces . Clear ( ) ;
3636 return result ;
@@ -79,11 +79,9 @@ private Class GetNewInterface(string name, Class @base)
7979 else
8080 {
8181 Class template = specialization . TemplatedDecl . TemplatedClass ;
82- Class templatedInterface ;
83- if ( templatedInterfaces . ContainsKey ( template ) )
84- templatedInterface = templatedInterfaces [ template ] ;
85- else
86- templatedInterfaces [ template ] = templatedInterface = GetInterface ( template ) ;
82+ Class templatedInterface = GetInterface ( template ) ;
83+ if ( interfaces . ContainsKey ( specialization ) )
84+ return interfaces [ specialization ] ;
8785 var specializedInterface = new ClassTemplateSpecialization ( ) ;
8886 specializedInterface . Arguments . AddRange ( specialization . Arguments ) ;
8987 specializedInterface . TemplatedDecl = new ClassTemplate { TemplatedDecl = templatedInterface } ;
@@ -94,11 +92,6 @@ private Class GetNewInterface(string name, Class @base)
9492 @interface . Access = @base . Access ;
9593 @interface . Type = ClassType . Interface ;
9694 @interface . OriginalClass = @base ;
97- if ( @base . IsTemplate )
98- {
99- @interface . IsDependent = true ;
100- @interface . TemplateParameters . AddRange ( @base . TemplateParameters ) ;
101- }
10295
10396 @interface . Bases . AddRange (
10497 from b in @base . Bases
@@ -157,8 +150,15 @@ where property.IsDeclared
157150
158151 @base . Bases . Add ( new BaseClassSpecifier { Type = new TagType ( @interface ) } ) ;
159152
160- if ( specialization == null )
161- interfaces . Add ( @base , @interface ) ;
153+ interfaces . Add ( @base , @interface ) ;
154+ if ( @base . IsTemplate )
155+ {
156+ @interface . IsDependent = true ;
157+ @interface . TemplateParameters . AddRange ( @base . TemplateParameters ) ;
158+ templatedInterfaces [ @base ] = @interface ;
159+ foreach ( var spec in @base . Specializations )
160+ GetNewInterface ( name , spec ) ;
161+ }
162162 return @interface ;
163163 }
164164
0 commit comments