Skip to content

Commit fd90016

Browse files
committed
support SFINAE via function parameters
#feat
1 parent 0bc88b6 commit fd90016

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/lib/AST/ASTVisitor.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,30 @@ populate(
870870
{
871871
populate(I.Requires, TRC);
872872
}
873+
else
874+
{
875+
// Iterate I.Params to find trailing requires clauses
876+
for (auto it = I.Params.begin(); it != I.Params.end(); )
877+
{
878+
if (it->Type &&
879+
!it->Type->Constraints.empty())
880+
{
881+
for (ExprInfo const& constraint: it->Type->Constraints)
882+
{
883+
if (!I.Requires.Written.empty())
884+
{
885+
I.Requires.Written += " && ";
886+
}
887+
I.Requires.Written += constraint.Written;
888+
}
889+
it = I.Params.erase(it);
890+
}
891+
else
892+
{
893+
++it;
894+
}
895+
}
896+
}
873897

874898
populateAttributes(I, D);
875899
}

0 commit comments

Comments
 (0)