d: Merge upstream dmd, druntime 4c18eed967, phobos d945686a4.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / fail17955.d
blob43ce5cc42fcee653da41f946f2889c2ace4acb8f
1 // https://issues.dlang.org/show_bug.cgi?id=17955
2 /*
3 TEST_OUTPUT:
4 ---
5 fail_compilation/fail17955.d(82): Error: cannot create instance of abstract class `SimpleTimeZone`
6 fail_compilation/fail17955.d(76): class `SimpleTimeZone` is declared here
7 fail_compilation/fail17955.d(73): function `bool hasDST()` is not implemented
8 fail_compilation/fail17955.d(94): Error: template instance `fail17955.SimpleTimeZone.fromISOExtString!dstring` error instantiating
9 fail_compilation/fail17955.d(26): instantiated from here: `fromISOExtString!string`
10 fail_compilation/fail17955.d(57): instantiated from here: `isISOExtStringSerializable!(SysTime)`
11 fail_compilation/fail17955.d(50): instantiated from here: `toRedis!(SysTime)`
12 fail_compilation/fail17955.d(41): ... (2 instantiations, -v to show) ...
13 fail_compilation/fail17955.d(33): instantiated from here: `indicesOf!(isRedisType, resetCodeExpireTime)`
14 fail_compilation/fail17955.d(68): instantiated from here: `RedisStripped!(User, true)`
15 fail_compilation/fail17955.d(94): Error: calling non-static function `fromISOExtString` requires an instance of type `SimpleTimeZone`
16 fail_compilation/fail17955.d(96): Error: undefined identifier `DateTimeException`
17 fail_compilation/fail17955.d(26): Error: variable `fail17955.isISOExtStringSerializable!(SysTime).isISOExtStringSerializable` - type `void` is inferred from initializer `fromISOExtString("")`, and variables cannot be of type `void`
18 fail_compilation/fail17955.d(55): Error: function `fail17955.toRedis!(SysTime).toRedis` has no `return` statement, but is expected to return a value of type `string`
19 ---
22 alias Alias(alias a) = a;
24 template isISOExtStringSerializable(T)
26 enum isISOExtStringSerializable = T.fromISOExtString("");
29 template RedisObjectCollection(){}
31 struct RedisStripped(T, bool strip_id = true)
33 alias unstrippedMemberIndices = indicesOf!(Select!(strip_id,
34 isRedisTypeAndNotID, isRedisType), T.tupleof);
37 template indicesOf(alias PRED, T...)
39 template impl(size_t i)
41 static if (PRED!T)
42 impl TypeTuple;
45 alias indicesOf = impl!0;
48 template isRedisType(alias F)
50 enum isRedisType = toRedis!(typeof(F));
53 template isRedisTypeAndNotID(){}
55 string toRedis(T)()
57 static if (isISOExtStringSerializable!T)
58 return;
61 struct User
63 SysTime resetCodeExpireTime;
66 class RedisUserManController
68 RedisObjectCollection!(RedisStripped!User) m_users;
71 class TimeZone
73 abstract bool hasDST();
76 class SimpleTimeZone : TimeZone
78 unittest {}
80 immutable(SimpleTimeZone) fromISOExtString(S)(S)
82 new SimpleTimeZone;
86 struct SysTime
89 static fromISOExtString(S)(S)
91 dstring zoneStr;
93 try
94 SimpleTimeZone.fromISOExtString(zoneStr);
96 catch (DateTimeException e) {}
100 template Select(bool condition, T...)
102 alias Select = Alias!(T[condition]);