Skip to content

Commit

Permalink
Merge pull request #7277 from WalterBright/fix17955
Browse files Browse the repository at this point in the history
fix Issue 17955 - compiler segfault in DsymbolSemanticVisitor::visit(…
merged-on-behalf-of: Iain Buclaw <ibuclaw@gdcproject.org>
  • Loading branch information
dlang-bot committed Nov 3, 2017
2 parents c03a05a + a32b62f commit 56e4861
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ddmd/dclass.d
Expand Up @@ -894,7 +894,7 @@ extern (C++) class ClassDeclaration : AggregateDeclaration
extern (C++) static int virtualSemantic(Dsymbol s, void* param)
{
auto fd = s.isFuncDeclaration();
if (fd && !(fd.storage_class & STCstatic))
if (fd && !(fd.storage_class & STCstatic) && !fd.isUnitTestDeclaration())
fd.dsymbolSemantic(null);
return 0;
}
Expand Down
84 changes: 84 additions & 0 deletions test/fail_compilation/fail17955.d
@@ -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]);
}

0 comments on commit 56e4861

Please sign in to comment.