File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -547,8 +547,7 @@ public Dsymbol mostVisibleOverload(Dsymbol s)
547547{
548548 if (! s.isOverloadable())
549549 return s;
550-
551- Dsymbol next, fstart = s, mostVisible = s;
550+ Dsymbol next, fstart = s, mostVisible = s, previous = null ;
552551 for (; s; s = next)
553552 {
554553 // void func() {}
@@ -593,7 +592,10 @@ public Dsymbol mostVisibleOverload(Dsymbol s)
593592 */
594593 auto aliasee = ad.toAlias();
595594 if (aliasee.isFuncAliasDeclaration || aliasee.isOverDeclaration)
595+ {
596+ error(ad.loc, " `alias X = X` not allowed (with `X = %s`)" , ad.toChars());
596597 next = aliasee;
598+ }
597599 else
598600 {
599601 /* A simple alias can be at the end of a function or template overload chain.
@@ -613,6 +615,13 @@ public Dsymbol mostVisibleOverload(Dsymbol s)
613615
614616 if (next && mostVisible.prot().isMoreRestrictiveThan(next.prot()))
615617 mostVisible = next;
618+
619+ // fixes https://issues.dlang.org/show_bug.cgi?id=18480
620+ if (next && next == previous)
621+ {
622+ return next;
623+ }
624+ previous = s;
616625 }
617626 return mostVisible;
618627}
You can’t perform that action at this time.
0 commit comments