www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9923] New: [ICE] (interpret.c line 167) with countUntil on Typedef[]

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

           Summary: [ICE] (interpret.c line 167) with countUntil on
                    Typedef[]
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2013-04-11 16:03:48 PDT ---
import std.algorithm: countUntil;
import std.typecons: Typedef;
alias Foo = Typedef!(const string);
immutable Foo[] bar = ["a", "b"];
void main() {
    Foo a;
    countUntil(bar, a);
}



DMD 2.063alpha gives:

Assertion failure: 'v->ctfeAdrOnStack >= 0 && v->ctfeAdrOnStack <
stackPointer()' on line 167 in file 'interpret.c'


Removing the const the compiler doesn't crash:

import std.algorithm: countUntil;
import std.typecons: Typedef;
alias Foo = Typedef!(string);
immutable Foo[] bar = ["a", "b"];
void main() {
    Foo a;
    countUntil(bar, a);
}

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


Don <clugdbug yahoo.com.au> changed:

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


--- Comment #1 from Don <clugdbug yahoo.com.au> 2013-06-12 23:55:32 PDT ---
With latest HEAD, now gives 

std/typecons.d(3886): Error: cannot modify const expression Typedef_payload
walter.d(4): Error: CTFE failed because of previous errors in this

There's a bug in Phobos. That type of bug no longer triggers a crash in CTFE.

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



--- Comment #2 from bearophile_hugs eml.cc 2013-06-13 09:41:03 PDT ---
(In reply to comment #1)

 There's a bug in Phobos. That type of bug no longer triggers a crash in CTFE.
Do you suggest me to open some kind of Phobos bug report? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 13 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9923


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com


--- Comment #3 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-06-17
16:56:46 PDT ---
(In reply to comment #2)
 (In reply to comment #1)
 
 There's a bug in Phobos. That type of bug no longer triggers a crash in CTFE.
Do you suggest me to open some kind of Phobos bug report?
It looks to me like a compiler bug: ----- struct Typedef(T, T init, string cookie=null) { private T Typedef_payload = init; this(T init) { Typedef_payload = init; // should be allowed AFAIK } mixin Proxy!Typedef_payload; } ----- Try filing it. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 17 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9923



--- Comment #4 from bearophile_hugs eml.cc 2013-06-17 17:30:36 PDT ---
(In reply to comment #3)

 It looks to me like a compiler bug:
 
 -----
 struct Typedef(T, T init, string cookie=null)
 {
     private T Typedef_payload = init;
 
     this(T init)
     {
         Typedef_payload = init;  // should be allowed AFAIK
     }
 
     mixin Proxy!Typedef_payload;
 }
 -----
 
 Try filing it.
This code is working: import std.typecons: Proxy; struct Foo(T, T init, string cookie=null) { private T bar = init; this(T init) { bar = init; } mixin Proxy!bar; } void main() { auto f = Foo!(int, 0, "abc")(10); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 17 2013