Skip to content

Commit

Permalink
fix Issue 22714 - ICE: Assertion failure in ClassDeclaration::isBaseOf
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuclaw authored and dlang-bot committed Jan 31, 2022
1 parent 9759c53 commit 5436d4d
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/dmd/mtype.d
Original file line number Diff line number Diff line change
Expand Up @@ -6360,6 +6360,9 @@ extern (C++) final class TypeClass : Type

override MOD deduceWild(Type t, bool isRef)
{
// If sym is forward referenced:
if (sym.semanticRun < PASS.semanticdone && !sym.isBaseInfoComplete())
sym.dsymbolSemantic(null);
ClassDeclaration cd = t.isClassHandle();
if (cd && (sym == cd || cd.isBaseOf(sym, null)))
return Type.deduceWild(t, isRef);
Expand Down
3 changes: 3 additions & 0 deletions test/compilable/imports/test22714a.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module imports.test22714a;
import imports.test22714b;
class Statement {}
12 changes: 12 additions & 0 deletions test/compilable/imports/test22714b.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module imports.test22714b;
import imports.test22714a;
struct Array(T)
{
T[] data;
T[1] smallarray;
}
struct Ensure
{
Statement ensure;
Array!Ensure* arraySyntaxCopy;
}
2 changes: 2 additions & 0 deletions test/compilable/test22714.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// https://issues.dlang.org/show_bug.cgi?id=22714
import imports.test22714a;
2 changes: 2 additions & 0 deletions test/fail_compilation/ice10727a.d
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
TEST_OUTPUT:
---
fail_compilation/imports/foo10727a.d(34): Error: undefined identifier `Frop`
fail_compilation/imports/foo10727a.d(26): Error: template instance `foo10727a.CirBuff!(Foo)` error instantiating
fail_compilation/imports/foo10727a.d(31): instantiated from here: `Bar!(Foo)`
---
*/

Expand Down
2 changes: 2 additions & 0 deletions test/fail_compilation/ice10727b.d
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
TEST_OUTPUT:
---
fail_compilation/imports/foo10727b.d(25): Error: undefined identifier `Frop`
fail_compilation/imports/foo10727b.d(17): Error: template instance `foo10727b.CirBuff!(Foo)` error instantiating
fail_compilation/imports/foo10727b.d(22): instantiated from here: `Bar!(Foo)`
---
*/

Expand Down

0 comments on commit 5436d4d

Please sign in to comment.