libphobos/testsuite/libphobos.traits/all_satisfy.d
raw| 1 | // https://issues.dlang.org/show_bug.cgi?id=22210 |
| 2 | |
| 3 | import core.internal.traits : allSatisfy; |
| 4 | |
| 5 | enum isHashable(T) = __traits(compiles, |
| 6 | () { T.init; } |
| 7 | ); |
| 8 | |
| 9 | class A |
| 10 | { |
| 11 | static if (isHashable!B) {} |
| 12 | } |
| 13 | |
| 14 | class B |
| 15 | { |
| 16 | static if (isHashable!C) {} |
| 17 | } |
| 18 | |
| 19 | class C |
| 20 | { |
| 21 | static if (allSatisfy!(isHashable, int, B)) {} |
| 22 | } |
| 23 | |
| 24 | void main() {} |