Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7277 from WalterBright/fix17955
fix Issue 17955 - compiler segfault in DsymbolSemanticVisitor::visit(… merged-on-behalf-of: Iain Buclaw <ibuclaw@gdcproject.org>
- Loading branch information
Showing
2 changed files
with
85 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// https://issues.dlang.org/show_bug.cgi?id=17955 | ||
|
||
alias Alias(alias a) = a; | ||
|
||
template isISOExtStringSerializable(T) | ||
{ | ||
enum isISOExtStringSerializable = T.fromISOExtString(""); | ||
} | ||
|
||
template RedisObjectCollection(){} | ||
|
||
struct RedisStripped(T, bool strip_id = true) | ||
{ | ||
alias unstrippedMemberIndices = indicesOf!(Select!(strip_id, | ||
isRedisTypeAndNotID, isRedisType), T.tupleof); | ||
} | ||
|
||
template indicesOf(alias PRED, T...) | ||
{ | ||
template impl(size_t i) | ||
{ | ||
static if (PRED!T) | ||
impl TypeTuple; | ||
} | ||
|
||
alias indicesOf = impl!0; | ||
} | ||
|
||
template isRedisType(alias F) | ||
{ | ||
enum isRedisType = toRedis!(typeof(F)); | ||
} | ||
|
||
template isRedisTypeAndNotID(){} | ||
|
||
string toRedis(T)() | ||
{ | ||
static if (isISOExtStringSerializable!T) | ||
return; | ||
} | ||
|
||
struct User | ||
{ | ||
SysTime resetCodeExpireTime; | ||
} | ||
|
||
class RedisUserManController | ||
{ | ||
RedisObjectCollection!(RedisStripped!User) m_users; | ||
} | ||
|
||
class TimeZone | ||
{ | ||
abstract bool hasDST(); | ||
} | ||
|
||
class SimpleTimeZone : TimeZone | ||
{ | ||
unittest {} | ||
|
||
immutable(SimpleTimeZone) fromISOExtString(S)(S) | ||
{ | ||
new SimpleTimeZone; | ||
} | ||
} | ||
|
||
struct SysTime | ||
{ | ||
|
||
static fromISOExtString(S)(S) | ||
{ | ||
dstring zoneStr; | ||
|
||
try | ||
SimpleTimeZone.fromISOExtString(zoneStr); | ||
|
||
catch DateTimeException; | ||
} | ||
} | ||
|
||
template Select(bool condition, T...) | ||
{ | ||
alias Select = Alias!(T[condition]); | ||
} |