Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Issue 22714 - ICE: Assertion failure in ClassDeclaration::isBaseOf #13588

Merged
merged 1 commit into from
Jan 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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