We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 772ff9a + 532e273 commit b3bbae5Copy full SHA for b3bbae5
src/statement.c
@@ -3634,6 +3634,8 @@ Statement *ReturnStatement::semantic(Scope *sc)
3634
exp = exp->castTo(sc, exp->type->invariantOf());
3635
}
3636
3637
+ if (fd->tintro)
3638
+ exp = exp->implicitCastTo(sc, fd->type->nextOf());
3639
exp = exp->implicitCastTo(sc, tret);
3640
if (!((TypeFunction *)fd->type)->isref)
3641
exp = exp->optimize(WANTvalue);
test/fail_compilation/fail4511.d
@@ -0,0 +1,16 @@
1
+void test72()
2
+{
3
+ class A {}
4
+ class B : A {}
5
+
6
+ class X
7
+ {
8
+ abstract A func();
9
+ }
10
+ class Y : X
11
12
+ B func() { return new A(); }
13
14
+}
15
16
+void main() {}
0 commit comments