d: Merge upstream dmd, druntime 4ca4140e58, phobos 454dff14d.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / fail17955.d
blob95eb5cc8c1f92639456752d5e91b8f7835a5ae5d
1 // https://issues.dlang.org/show_bug.cgi?id=17955
2 /*
3 TEST_OUTPUT:
4 ---
5 fail_compilation/fail17955.d(81): Error: cannot create instance of abstract class `SimpleTimeZone`
6 fail_compilation/fail17955.d(81): function `bool hasDST()` is not implemented
7 fail_compilation/fail17955.d(93): Error: template instance `fail17955.SimpleTimeZone.fromISOExtString!dstring` error instantiating
8 fail_compilation/fail17955.d(25): instantiated from here: `fromISOExtString!string`
9 fail_compilation/fail17955.d(56): instantiated from here: `isISOExtStringSerializable!(SysTime)`
10 fail_compilation/fail17955.d(49): instantiated from here: `toRedis!(SysTime)`
11 fail_compilation/fail17955.d(40): ... (2 instantiations, -v to show) ...
12 fail_compilation/fail17955.d(32): instantiated from here: `indicesOf!(isRedisType, resetCodeExpireTime)`
13 fail_compilation/fail17955.d(67): instantiated from here: `RedisStripped!(User, true)`
14 fail_compilation/fail17955.d(93): Error: need `this` for `fromISOExtString` of type `pure nothrow @nogc @safe immutable(SimpleTimeZone)(dstring _param_0)`
15 fail_compilation/fail17955.d(95): Error: undefined identifier `DateTimeException`
16 fail_compilation/fail17955.d(25): Error: variable `fail17955.isISOExtStringSerializable!(SysTime).isISOExtStringSerializable` - type `void` is inferred from initializer `fromISOExtString("")`, and variables cannot be of type `void`
17 fail_compilation/fail17955.d(54): Error: function `fail17955.toRedis!(SysTime).toRedis` has no `return` statement, but is expected to return a value of type `string`
18 ---
21 alias Alias(alias a) = a;
23 template isISOExtStringSerializable(T)
25 enum isISOExtStringSerializable = T.fromISOExtString("");
28 template RedisObjectCollection(){}
30 struct RedisStripped(T, bool strip_id = true)
32 alias unstrippedMemberIndices = indicesOf!(Select!(strip_id,
33 isRedisTypeAndNotID, isRedisType), T.tupleof);
36 template indicesOf(alias PRED, T...)
38 template impl(size_t i)
40 static if (PRED!T)
41 impl TypeTuple;
44 alias indicesOf = impl!0;
47 template isRedisType(alias F)
49 enum isRedisType = toRedis!(typeof(F));
52 template isRedisTypeAndNotID(){}
54 string toRedis(T)()
56 static if (isISOExtStringSerializable!T)
57 return;
60 struct User
62 SysTime resetCodeExpireTime;
65 class RedisUserManController
67 RedisObjectCollection!(RedisStripped!User) m_users;
70 class TimeZone
72 abstract bool hasDST();
75 class SimpleTimeZone : TimeZone
77 unittest {}
79 immutable(SimpleTimeZone) fromISOExtString(S)(S)
81 new SimpleTimeZone;
85 struct SysTime
88 static fromISOExtString(S)(S)
90 dstring zoneStr;
92 try
93 SimpleTimeZone.fromISOExtString(zoneStr);
95 catch (DateTimeException e) {}
99 template Select(bool condition, T...)
101 alias Select = Alias!(T[condition]);