diff --git a/std/datetime.d b/std/datetime.d index 9d7dd996a4f..57af05e2bf5 100644 --- a/std/datetime.d +++ b/std/datetime.d @@ -25824,9 +25824,7 @@ static TP delegate(in TP) everyDayOfWeek(TP, Direction dir = Direction.fwd)(DayO (dir == Direction.fwd || dir == Direction.bwd) && __traits(hasMember, TP, "dayOfWeek") && !__traits(isStaticFunction, TP.dayOfWeek) && - is(ReturnType!(TP.dayOfWeek) == DayOfWeek) && - (functionAttributes!(TP.dayOfWeek) & FunctionAttribute.property) && - (functionAttributes!(TP.dayOfWeek) & FunctionAttribute.nothrow_)) + is(typeof(TP.dayOfWeek) == DayOfWeek)) { TP func(in TP tp) { @@ -25958,9 +25956,7 @@ static TP delegate(in TP) everyMonth(TP, Direction dir = Direction.fwd)(int mont (dir == Direction.fwd || dir == Direction.bwd) && __traits(hasMember, TP, "month") && !__traits(isStaticFunction, TP.month) && - is(ReturnType!(TP.month) == Month) && - (functionAttributes!(TP.month) & FunctionAttribute.property) && - (functionAttributes!(TP.month) & FunctionAttribute.nothrow_)) + is(typeof(TP.month) == Month)) { enforceValid!"months"(month); @@ -33028,10 +33024,7 @@ template hasMin(T) { enum hasMin = __traits(hasMember, T, "min") && __traits(isStaticFunction, T.min) && - is(ReturnType!(T.min) == Unqual!T) && - (functionAttributes!(T.min) & FunctionAttribute.property) && - (functionAttributes!(T.min) & FunctionAttribute.nothrow_); - //(functionAttributes!(T.min) & FunctionAttribute.pure_); //Ideally this would be the case, but SysTime's min() can't currently be pure. + is(typeof(T.min) == Unqual!T); } unittest @@ -33061,10 +33054,7 @@ template hasMax(T) { enum hasMax = __traits(hasMember, T, "max") && __traits(isStaticFunction, T.max) && - is(ReturnType!(T.max) == Unqual!T) && - (functionAttributes!(T.max) & FunctionAttribute.property) && - (functionAttributes!(T.max) & FunctionAttribute.nothrow_); - //(functionAttributes!(T.max) & FunctionAttribute.pure_); //Ideally this would be the case, but SysTime's max() can't currently be pure. + is(typeof(T.max) == Unqual!T); } unittest diff --git a/std/typecons.d b/std/typecons.d index 9d7b7897bce..7b79d5f32a6 100644 --- a/std/typecons.d +++ b/std/typecons.d @@ -2974,21 +2974,24 @@ private template GetOverloadedMethods(T) { alias follows = TypeTuple!(); } + else static if (allMembers[i] == "this") + { + alias follows = follows!(i + 1); + } else { enum name = allMembers[i]; - template isFunction(T, string name) + template isMethod(alias f) { - static if (is(typeof(mixin("&T."~name)) F == F*) && is(F == function)) - enum isFunction = true; + static if (is(typeof(&f) F == F*) && is(F == function)) + enum isMethod = !__traits(isStaticFunction, f); else - enum isFunction = false; + enum isMethod = false; } - static if (isFunction!(T, name) && !__traits(isStaticFunction, mixin("T."~name))) - alias follows = TypeTuple!(__traits(getOverloads, T, name), follows!(i + 1)); - else - alias follows = follows!(i + 1); + alias follows = TypeTuple!( + std.typetuple.Filter!(isMethod, __traits(getOverloads, T, name)), + follows!(i + 1)); } } alias GetOverloadedMethods = follows!();