@@ -83,7 +83,7 @@ bool cpp_typecheck_fargst::match(
83
83
{
84
84
distance=0 ;
85
85
86
- exprt::operandst ops = operands;
86
+ exprt::operandst ops= operands;
87
87
const code_typet::parameterst ¶meters=code_type.parameters ();
88
88
89
89
if (parameters.size ()>ops.size ())
@@ -109,7 +109,8 @@ bool cpp_typecheck_fargst::match(
109
109
return false ;
110
110
}
111
111
112
- for (std::size_t i=0 ; i<ops.size (); i++)
112
+ exprt::operandst::iterator it=ops.begin ();
113
+ for (const auto ¶meter : parameters)
113
114
{
114
115
// read
115
116
// http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/topic/com.ibm.xlcpp8a.doc/language/ref/implicit_conversion_sequences.htm
@@ -119,16 +120,9 @@ bool cpp_typecheck_fargst::match(
119
120
// * User-defined conversion sequences
120
121
// * Ellipsis conversion sequences
121
122
122
- if (i>=parameters.size ())
123
- {
124
- // Ellipsis is the 'worst' of the conversion sequences
125
- distance+=1000 ;
126
- continue ;
127
- }
128
-
129
- exprt parameter=parameters[i];
130
-
131
- exprt &operand=ops[i];
123
+ assert (it!=ops.end ());
124
+ const exprt &operand=*it;
125
+ typet type=parameter.type ();
132
126
133
127
#if 0
134
128
// unclear, todo
@@ -140,13 +134,13 @@ bool cpp_typecheck_fargst::match(
140
134
141
135
// "this" is a special case -- we turn the pointer type
142
136
// into a reference type to do the type matching
143
- if (i== 0 && parameter.get (ID_C_base_name)==ID_this)
137
+ if (it==ops. begin () && parameter.get (ID_C_base_name)==ID_this)
144
138
{
145
- parameter. type () .set (ID_C_reference, true );
146
- parameter. type () .set (" #this" , true );
139
+ type.set (ID_C_reference, true );
140
+ type.set (" #this" , true );
147
141
}
148
142
149
- unsigned rank = 0 ;
143
+ unsigned rank= 0 ;
150
144
exprt new_expr;
151
145
152
146
#if 0
@@ -156,7 +150,7 @@ bool cpp_typecheck_fargst::match(
156
150
157
151
// can we do the standard conversion sequence?
158
152
if (cpp_typecheck.implicit_conversion_sequence (
159
- operand, parameter. type () , new_expr, rank))
153
+ operand, type, new_expr, rank))
160
154
{
161
155
// ok
162
156
distance+=rank;
@@ -171,7 +165,14 @@ bool cpp_typecheck_fargst::match(
171
165
#endif
172
166
return false ; // no conversion possible
173
167
}
168
+
169
+ ++it;
174
170
}
175
171
172
+ // we may not have used all operands
173
+ for ( ; it!=ops.end (); ++it)
174
+ // Ellipsis is the 'worst' of the conversion sequences
175
+ distance+=1000 ;
176
+
176
177
return true ;
177
178
}
0 commit comments