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)
278
278
if ( finalType . TryGetClass ( out returnedClass ) && returnedClass . IsDependent )
279
279
Context . Return . Write ( $ "({ returnType . Visit ( typePrinter ) } ) (object) ") ;
280
280
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 ( ) )
282
284
Context . Return . Write ( HandleReturnedPointer ( @class , qualifiedClass ) ) ;
283
285
else
284
286
{
Original file line number Diff line number Diff line change @@ -1176,17 +1176,20 @@ public void TestTemplateWithIndexer()
1176
1176
templateWithIndexer [ "test" ] = 15 ;
1177
1177
Assert . That ( templateWithIndexer [ "test" ] , Is . EqualTo ( 15 ) ) ;
1178
1178
}
1179
- using ( var templateWithIndexer = new TemplateWithIndexer < T1 > ( ) )
1179
+ using ( var templateWithIndexer = new TemplateWithIndexer < T2 > ( ) )
1180
1180
{
1181
- using ( var t1 = new T1 ( 10 ) )
1181
+ using ( var t2 = new T2 ( ) )
1182
1182
{
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 ) ) ;
1185
1188
}
1186
- using ( var t1 = new T1 ( 15 ) )
1189
+ using ( var t2 = new T2 ( 15 ) )
1187
1190
{
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 ) ) ;
1190
1193
}
1191
1194
}
1192
1195
}
Original file line number Diff line number Diff line change 1
1
#include " CSharpTemplates.h"
2
2
3
- T1::T1 ( )
3
+ T2::T2 () : field( 0 )
4
4
{
5
5
}
6
6
7
- T1::T1 (const T1& other) : field(other.field)
8
- {
9
- }
10
-
11
- T1::T1 (int f)
7
+ T2::T2 (int f)
12
8
{
13
9
field = f;
14
10
}
15
11
16
- T1 ::~T1 ()
12
+ T2 ::~T2 ()
17
13
{
18
14
}
19
15
20
- int T1 ::getField () const
16
+ int T2 ::getField () const
21
17
{
22
18
return field;
23
19
}
24
20
25
- T2::T2 ( )
21
+ void T2::setField ( int value )
26
22
{
23
+ field = value;
27
24
}
28
25
29
26
DerivedFromSpecializationOfUnsupportedTemplate::DerivedFromSpecializationOfUnsupportedTemplate ()
Original file line number Diff line number Diff line change @@ -12,20 +12,18 @@ class DLL_API QString
12
12
13
13
class DLL_API T1
14
14
{
15
- public:
16
- T1 ();
17
- T1 (const T1& other);
18
- T1 (int f);
19
- ~T1 ();
20
- int getField () const ;
21
- private:
22
- int field;
23
15
};
24
16
25
17
class DLL_API T2
26
18
{
27
19
public:
28
20
T2 ();
21
+ T2 (int f);
22
+ virtual ~T2 ();
23
+ int getField () const ;
24
+ void setField (int value);
25
+ private:
26
+ int field;
29
27
};
30
28
31
29
class DLL_API Ignored
@@ -92,7 +90,7 @@ IndependentFields<T>::IndependentFields(float f)
92
90
}
93
91
94
92
template <typename T>
95
- IndependentFields<T>::IndependentFields(const std::map<T, T> &v)
93
+ IndependentFields<T>::IndependentFields(const std::map<T, T> &v) : independent( 1 )
96
94
{
97
95
}
98
96
You can’t perform that action at this time.
0 commit comments