@@ -811,7 +811,7 @@ populate(
811
811
{
812
812
populate (I.Requires , TRC);
813
813
}
814
- else
814
+ else if (I. Requires . Written . empty ())
815
815
{
816
816
// Return type SFINAE constraints
817
817
if (I.ReturnType &&
@@ -1200,33 +1200,37 @@ populate(
1200
1200
}
1201
1201
1202
1202
// Extract requires clause from SFINAE context
1203
- for ( auto it = Template.Args . begin (); it != Template. Args . end (); )
1203
+ if ( Template.Requires . Written . empty () )
1204
1204
{
1205
- auto & arg = *it;
1206
- if (!arg)
1207
- {
1208
- ++it;
1209
- continue ;
1210
- }
1211
- if (auto * T = dynamic_cast <TypeTArg*>(arg.operator ->());
1212
- T &&
1213
- T->Type &&
1214
- !T->Type ->Constraints .empty ())
1205
+ for (auto it = Template.Args .begin (); it != Template.Args .end ();)
1215
1206
{
1216
- for (ExprInfo const & constraint: T->Type ->Constraints )
1207
+ auto & arg = *it;
1208
+ if (!arg)
1209
+ {
1210
+ ++it;
1211
+ continue ;
1212
+ }
1213
+ if (auto * T = dynamic_cast <TypeTArg*>(arg.operator ->());
1214
+ T &&
1215
+ T->Type &&
1216
+ !T->Type ->Constraints .empty ())
1217
1217
{
1218
- if (!Template. Requires . Written . empty () )
1218
+ for (ExprInfo const & constraint: T-> Type -> Constraints )
1219
1219
{
1220
- Template.Requires .Written += " && " ;
1220
+ if (!Template.Requires .Written .empty ())
1221
+ {
1222
+ Template.Requires .Written += " && " ;
1223
+ }
1224
+ Template.Requires .Written += constraint.Written ;
1221
1225
}
1222
- Template.Requires .Written += constraint.Written ;
1226
+ it = Template.Args .erase (it);
1227
+ continue ;
1223
1228
}
1224
- it = Template.Args .erase (it);
1225
- continue ;
1229
+ ++it;
1226
1230
}
1227
- ++it;
1228
1231
}
1229
1232
1233
+
1230
1234
// Extract the template parameters if this is a partial specialization
1231
1235
if (auto * CTPSD = dyn_cast<ClassTemplatePartialSpecializationDecl>(CTSD))
1232
1236
{
@@ -1468,7 +1472,7 @@ populate(
1468
1472
{
1469
1473
populate (TI.Requires , RC);
1470
1474
}
1471
- else
1475
+ else if (TI. Requires . Written . empty ())
1472
1476
{
1473
1477
// If there's no requires clause, check if the template
1474
1478
// parameter types we extracted have constraints
0 commit comments