Skip to content

Commit

Permalink
Merge pull request #7588 from WalterBright/fix16621
Browse files Browse the repository at this point in the history
fix Issue 16621 - [REG2.060] DMD hang in semantic3 on alias this
merged-on-behalf-of: Sebastian Wilzbach <sebi.wilzbach@gmail.com>
  • Loading branch information
dlang-bot committed Jan 4, 2018
2 parents c6761a7 + d2e2670 commit 72f76d0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/dmd/mtype.d
Expand Up @@ -6,6 +6,8 @@
* Authors: $(LINK2 http://www.digitalmars.com, Walter Bright)
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/mtype.d, _mtype.d)
* Documentation: https://dlang.org/phobos/dmd_mtype.html
* Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/mtype.d
*/

module dmd.mtype;
Expand Down Expand Up @@ -6057,9 +6059,12 @@ extern (C++) final class TypeFunction : TypeNext
*/
while (1)
{
Type tat = ta.toBasetype().aliasthisOf();
Type tab = ta.toBasetype();
Type tat = tab.aliasthisOf();
if (!tat || !tat.implicitConvTo(tprm))
break;
if (tat == tab)
break;
ta = tat;
}

Expand Down
23 changes: 23 additions & 0 deletions test/compilable/test16621.d
@@ -0,0 +1,23 @@
// https://issues.dlang.org/show_bug.cgi?id=16621

template xxx()
{
Vector2f xxx()
{
return this;
}
}

struct Vector2f
{
mixin xxx!();
alias xxx this;
}

void foo(ref Vector2f pos);

void test()
{
Vector2f v;
foo(v);
}

0 comments on commit 72f76d0

Please sign in to comment.