Skip to content

Commit

Permalink
Merge pull request #5265 from 9rnsr/fix15317
Browse files Browse the repository at this point in the history
Issue 15317 - Segfault in Type::kind() with DMD v2.069.0
  • Loading branch information
AndrejMitrovic committed Nov 15, 2015
2 parents b15e6c4 + 0c84150 commit 2c3a160
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
11 changes: 6 additions & 5 deletions src/expression.d
Expand Up @@ -3813,8 +3813,7 @@ public:
}
if (Type t = s.getType())
{
auto te = new TypeExp(loc, t);
return te.semantic(sc);
return (new TypeExp(loc, t)).semantic(sc);
}
if (TupleDeclaration tup = s.isTupleDeclaration())
{
Expand Down Expand Up @@ -5204,6 +5203,9 @@ public:

override Expression semantic(Scope* sc)
{
if (type.ty == Terror)
return new ErrorExp();

//printf("TypeExp::semantic(%s)\n", type->toChars());
Expression e;
Type t;
Expand Down Expand Up @@ -8101,10 +8103,9 @@ public:
//printf("'%s' is an overload set\n", o->toChars());
return new OverExp(loc, o);
}
Type t = s.getType();
if (t)
if (auto t = s.getType())
{
return new TypeExp(loc, t);
return (new TypeExp(loc, t)).semantic(sc);
}
TupleDeclaration tup = s.isTupleDeclaration();
if (tup)
Expand Down
8 changes: 4 additions & 4 deletions src/mtype.d
Expand Up @@ -7878,9 +7878,9 @@ public:
ve = ve.semantic(sc);
return ve;
}
if (s.getType())
if (auto t = s.getType())
{
return new TypeExp(e.loc, s.getType());
return (new TypeExp(e.loc, t)).semantic(sc);
}

TemplateMixin tm = s.isTemplateMixin();
Expand Down Expand Up @@ -8732,9 +8732,9 @@ public:
ve = ve.semantic(sc);
return ve;
}
if (s.getType())
if (auto t = s.getType())
{
return new TypeExp(e.loc, s.getType());
return (new TypeExp(e.loc, t)).semantic(sc);
}

TemplateMixin tm = s.isTemplateMixin();
Expand Down
13 changes: 13 additions & 0 deletions test/fail_compilation/ice15317.d
@@ -0,0 +1,13 @@
// REQUIRED_ARGS: -o-
/*
TEST_OUTPUT:
---
fail_compilation/ice15317.d(11): Error: undefined identifier 'fun'
---
*/

void main()
{
alias f = fun;
auto x1 = &f;
}

0 comments on commit 2c3a160

Please sign in to comment.