www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11230] New: Assertion failed: (type->ty != Tstruct || ((TypeStruct *)type)->sym == this), function semantic, file struct.c, line 876.

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11230

           Summary: Assertion failed: (type->ty != Tstruct || ((TypeStruct
                    *)type)->sym == this), function semantic, file
                    struct.c, line 876.
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: deadalnix gmail.com


--- Comment #0 from deadalnix <deadalnix gmail.com> 2013-10-11 17:38:40 PDT ---
Once again, a regression from DMD master (it used to compile).

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() {
}

output : Assertion failed: (type->ty != Tstruct || ((TypeStruct *)type)->sym ==
this), function semantic, file struct.c, line 876.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 11 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11230


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |INVALID


--- Comment #1 from Walter Bright <bugzilla digitalmars.com> 2013-10-13
11:33:29 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 13 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11230


deadalnix <deadalnix gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |


--- Comment #2 from deadalnix <deadalnix 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: -------
Oct 13 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11230


deadalnix <deadalnix gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |INVALID


--- Comment #3 from deadalnix <deadalnix gmail.com> 2013-10-13 12:25:42 PDT ---
(In reply to comment #2)
 (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
Ho damned, that is solved, indeed XD Sorry, for the noise. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 13 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11230


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |
            Summary|Assertion failed: (type->ty |[REG2.064a] Inexact
                   |!= Tstruct || ((TypeStruct  |mangling for template
                   |*)type)->sym == this),      |function literal.
                   |function semantic, file     |
                   |struct.c, line 876.         |


--- Comment #4 from Kenji Hara <k.hara.pg gmail.com> 2013-10-13 22:49:29 PDT ---
This is actually a regression. The OP code should be compiled as same with
2.063.

Introduced by:
https://github.com/D-Programming-Language/dmd/commit/3395a17dfe506c7a0dcf7370e7e4de4d98391528

Compiler fix:
https://github.com/D-Programming-Language/dmd/pull/2662

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 13 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11230



--- Comment #5 from Kenji Hara <k.hara.pg gmail.com> 2013-10-13 22:52:39 PDT ---
Correct test case from bug 11249 comment#0.

import std.algorithm;
class A {
    A[] as;
}

class B {
    A[] as;
}

A visit(A a) {
    a.as.map!(a => visit);
    return null;
}

A visit(B b) {
    b.as.map!(a => visit);
    return null;
}

A visit() {
    return null;
}

$ ../dmd/src/dmd -c -offail.o fail.d
../dmd/src/../../phobos/std/algorithm.d(415): Error: struct
fail.visit.MapResult!(__lambda2, A[]).MapResult failed semantic analysis
../dmd/src/../../phobos/std/algorithm.d(425): Error: this for _input needs to
be type MapResult not type MapResult!(__lambda2, A[])
../dmd/src/../../phobos/std/algorithm.d(430): Error: this for _input needs to
be type MapResult not type MapResult!(__lambda2, A[])
../dmd/src/../../phobos/std/algorithm.d(436): Error: this for _input needs to
be type MapResult not type MapResult!(__lambda2, A[])
../dmd/src/../../phobos/std/algorithm.d(448): Error: this for _input needs to
be type MapResult not type MapResult!(__lambda2, A[])
../dmd/src/../../phobos/std/algorithm.d(454): Error: this for _input needs to
be type MapResult not type MapResult!(__lambda2, A[])
../dmd/src/../../phobos/std/algorithm.d(459): Error: this for _input needs to
be type MapResult not type MapResult!(__lambda2, A[])
../dmd/src/../../phobos/std/algorithm.d(471): Error: this for _input needs to
be type MapResult not type MapResult!(__lambda2, A[])
../dmd/src/../../phobos/std/algorithm.d(479): Error: this for _input needs to
be type MapResult not type MapResult!(__lambda2, A[])
../dmd/src/../../phobos/std/algorithm.d(496): Error: this for _input needs to
be type MapResult not type MapResult!(__lambda2, A[])
../dmd/src/../../phobos/std/algorithm.d(411): Error: template instance
fail.visit.MapResult!(__lambda2, A[]) error instantiating
fail.d(18):        instantiated from here: map!(A[])
fail.d(18): Error: template instance fail.visit.map!((a) => visit).map!(A[])
error instantiating

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 13 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11230



--- Comment #6 from Kenji Hara <k.hara.pg gmail.com> 2013-10-13 22:53:28 PDT ---
*** Issue 11249 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 13 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11230



--- Comment #7 from github-bugzilla puremagic.com 2013-10-13 23:57:53 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/958c8593e3a8db3f904b9de8969e81333c49a148
fix Issue 11230 - Inexact mangling for template function literal.

https://github.com/D-Programming-Language/dmd/commit/fd862f455f7e33d3a0aae9016497d6c6b456d20a
Merge pull request #2662 from 9rnsr/fix11230

[REG2.064a] Issue 11230 - Inexact mangling for template function literal.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 13 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11230


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 14 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11230



--- Comment #8 from github-bugzilla puremagic.com 2013-10-16 21:27:36 PDT ---
Commit pushed to 2.064 at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/bdef38058bee65220f898216809b7101cd40cd14
Merge pull request #2662 from 9rnsr/fix11230

[REG2.064a] Issue 11230 - Inexact mangling for template function literal.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 16 2013