File tree Expand file tree Collapse file tree 4 files changed +26
-26
lines changed
src/Generator/Generators/CSharp Expand file tree Collapse file tree 4 files changed +26
-26
lines changed Original file line number Diff line number Diff line change @@ -278,7 +278,9 @@ public override bool VisitClassDecl(Class @class)
278278 if ( finalType . TryGetClass ( out returnedClass ) && returnedClass . IsDependent )
279279 Context . Return . Write ( $ "({ returnType . Visit ( typePrinter ) } ) (object) ") ;
280280
281- if ( returnType . IsAddress ( ) )
281+ // these two aren't the same for members of templates
282+ if ( Context . Function ? . OriginalReturnType . Type . Desugar ( ) . IsAddress ( ) == true ||
283+ returnType . IsAddress ( ) )
282284 Context . Return . Write ( HandleReturnedPointer ( @class , qualifiedClass ) ) ;
283285 else
284286 {
Original file line number Diff line number Diff line change @@ -1176,17 +1176,20 @@ public void TestTemplateWithIndexer()
11761176 templateWithIndexer [ "test" ] = 15 ;
11771177 Assert . That ( templateWithIndexer [ "test" ] , Is . EqualTo ( 15 ) ) ;
11781178 }
1179- using ( var templateWithIndexer = new TemplateWithIndexer < T1 > ( ) )
1179+ using ( var templateWithIndexer = new TemplateWithIndexer < T2 > ( ) )
11801180 {
1181- using ( var t1 = new T1 ( 10 ) )
1181+ using ( var t2 = new T2 ( ) )
11821182 {
1183- templateWithIndexer [ 0 ] = t1 ;
1184- Assert . That ( templateWithIndexer [ 0 ] . Field , Is . EqualTo ( t1 . Field ) ) ;
1183+ templateWithIndexer [ 0 ] = t2 ;
1184+ var item = templateWithIndexer [ 0 ] ;
1185+ Assert . That ( item . Field , Is . EqualTo ( t2 . Field ) ) ;
1186+ item . Field = 5 ;
1187+ Assert . That ( templateWithIndexer [ 0 ] . Field , Is . EqualTo ( 5 ) ) ;
11851188 }
1186- using ( var t1 = new T1 ( 15 ) )
1189+ using ( var t2 = new T2 ( 15 ) )
11871190 {
1188- templateWithIndexer [ "test" ] = t1 ;
1189- Assert . That ( templateWithIndexer [ "test" ] . Field , Is . EqualTo ( t1 . Field ) ) ;
1191+ templateWithIndexer [ "test" ] = t2 ;
1192+ Assert . That ( templateWithIndexer [ "test" ] . Field , Is . EqualTo ( t2 . Field ) ) ;
11901193 }
11911194 }
11921195 }
Original file line number Diff line number Diff line change 11#include " CSharpTemplates.h"
22
3- T1::T1 ( )
3+ T2::T2 () : field( 0 )
44{
55}
66
7- T1::T1 (const T1& other) : field(other.field)
8- {
9- }
10-
11- T1::T1 (int f)
7+ T2::T2 (int f)
128{
139 field = f;
1410}
1511
16- T1 ::~T1 ()
12+ T2 ::~T2 ()
1713{
1814}
1915
20- int T1 ::getField () const
16+ int T2 ::getField () const
2117{
2218 return field;
2319}
2420
25- T2::T2 ( )
21+ void T2::setField ( int value )
2622{
23+ field = value;
2724}
2825
2926DerivedFromSpecializationOfUnsupportedTemplate::DerivedFromSpecializationOfUnsupportedTemplate ()
Original file line number Diff line number Diff line change @@ -12,20 +12,18 @@ class DLL_API QString
1212
1313class DLL_API T1
1414{
15- public:
16- T1 ();
17- T1 (const T1& other);
18- T1 (int f);
19- ~T1 ();
20- int getField () const ;
21- private:
22- int field;
2315};
2416
2517class DLL_API T2
2618{
2719public:
2820 T2 ();
21+ T2 (int f);
22+ virtual ~T2 ();
23+ int getField () const ;
24+ void setField (int value);
25+ private:
26+ int field;
2927};
3028
3129class DLL_API Ignored
@@ -92,7 +90,7 @@ IndependentFields<T>::IndependentFields(float f)
9290}
9391
9492template <typename T>
95- IndependentFields<T>::IndependentFields(const std::map<T, T> &v)
93+ IndependentFields<T>::IndependentFields(const std::map<T, T> &v) : independent( 1 )
9694{
9795}
9896
You can’t perform that action at this time.
0 commit comments