[Issue 11230] Assertion failed: (type->ty != Tstruct || ((TypeStruct *)type)->sym == this), function semantic, file struct.c, line 876.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Oct 13 12:18:47 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11230
deadalnix <deadalnix at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|INVALID |
--- Comment #2 from deadalnix <deadalnix at gmail.com> 2013-10-13 12:18:46 PDT ---
(In reply to comment #1)
> With the 2.064 beta:
>
> test.d(14): Error: function test.visit has no return statement, but is expected
> to return a value of type test.C
>
> which is correct.
You stopped yourself to the first line. Added a return statement so you won't :
cat test.d
import std.algorithm;
class A {
A[] as;
}
class B {
A[] as;
}
class C : A {
}
C visit(A a) {
a.as.map!(a => visit);
}
C visit(B b) {
b.as.map!(a => visit);
}
C visit() {
return null;
}
./dmd test.d
test.d(15): Error: function test.visit has no return statement, but is expected
to return a value of type test.C
./../../phobos/std/algorithm.d(415): Error: struct
test.visit.MapResult!(__lambda2, A[]).MapResult failed semantic analysis
./../../phobos/std/algorithm.d(425): Error: this for _input needs to be type
MapResult not type MapResult!(__lambda2, A[])
./../../phobos/std/algorithm.d(430): Error: this for _input needs to be type
MapResult not type MapResult!(__lambda2, A[])
./../../phobos/std/algorithm.d(436): Error: this for _input needs to be type
MapResult not type MapResult!(__lambda2, A[])
./../../phobos/std/algorithm.d(448): Error: this for _input needs to be type
MapResult not type MapResult!(__lambda2, A[])
./../../phobos/std/algorithm.d(454): Error: this for _input needs to be type
MapResult not type MapResult!(__lambda2, A[])
./../../phobos/std/algorithm.d(459): Error: this for _input needs to be type
MapResult not type MapResult!(__lambda2, A[])
./../../phobos/std/algorithm.d(471): Error: this for _input needs to be type
MapResult not type MapResult!(__lambda2, A[])
./../../phobos/std/algorithm.d(479): Error: this for _input needs to be type
MapResult not type MapResult!(__lambda2, A[])
./../../phobos/std/algorithm.d(496): Error: this for _input needs to be type
MapResult not type MapResult!(__lambda2, A[])
./../../phobos/std/algorithm.d(411): Error: template instance
test.visit.MapResult!(__lambda2, A[]) error instantiating
test.d(20): instantiated from here: map!(A[])
test.d(20): Error: template instance test.visit.map!((a) => visit).map!(A[])
error instantiating
test.d(19): Error: function test.visit has no return statement, but is expected
to return a value of type test.C
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list