Fix template constraint of assumePureFunction

The constraint was actually a runtime `if`, leaving `assumePureFunction`
without a `return` at the end of the function.
This commit is contained in:
MoonlightSentinel 2021-04-26 13:35:26 +02:00 committed by The Dlang Bot
parent 3ded2f5c50
commit 5b6507df1f

View file

@ -568,12 +568,10 @@ private auto defaultFactoryImpl(Char)(const ref Regex!Char re)
// Used to generate a pure wrapper for defaultFactoryImpl. Based on the example in
// the std.traits.SetFunctionAttributes documentation.
private auto assumePureFunction(T)(T t)
if (isFunctionPointer!T)
{
if (isFunctionPointer!T)
{
enum attrs = functionAttributes!T | FunctionAttribute.pure_;
return cast(SetFunctionAttributes!(T, functionLinkage!T, attrs)) t;
}
}
// A workaround for R-T enum re = regex(...)