www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8934] New: Lambda violates DMD assertion

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

           Summary: Lambda violates DMD assertion
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: dimitri.sabadie gmail.com



04:38:54 PDT ---
I have found something interresting with lambdas. Consider this:

string modules[] = [ "foo", "bar", "zoo" ];
string line;

/* ... */

/* now line contains something not empty */
if (any!(a => a == line)(modules)) {
    /* ... */
}


I get a DMD assertion crash on the if statement:
    Assertion failure: '!vthis->csym' on line 727 in file 'glue.c'

Of course, the lambda syntax is, here,
    (string a) => a == line

But sometimes a => a == line also works as inference type lambda! I don’t know
why it doesn’t here. Also, this works too:
    (string a) { return a == line; }

Is it the old delegate literal syntax?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 02 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8934




04:40:29 PDT ---
Just to precise — as the topic name does — DMD fails to say that the error
is
on the lambda expression in the if statement. Instead it prints internal shit
assertions.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 02 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8934


Maxim Fomin <maxim maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxim maxim-fomin.ru



---
Regarding lambdas - it is well-known issue which consists in treating lambda
expression as voids: see issue 8899. Regarding internal compiler error - please
provide exact code which shows problem.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 02 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8934


Dmitry S <ds.dlang gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ds.dlang gmail.com



I tried to reproduce, but the following code compiles and works correctly with
dmd built from the current github head (on MacOSX):

  import std.stdio;
  import std.algorithm;

  string modules[] = [ "foo", "bar", "zoo" ];

  int main(string[] args) {
      foreach (string line; ["hello", "bar", "world"]) {
          if (any!(a => a == line)(modules)) {
              writeln(line, " found");
          } else {
              writeln(line, " not found");
          }
      }
      return 0;
  }

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 17 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8934


Brad Roberts <braddr puremagic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |braddr puremagic.com
         Resolution|                            |WORKSFORME



---
Based on the last comment, it's no longer reproducible.  This means that this
bug was likely a duplicate of another which was fixed between when the but was
reported and then re-tested.

Please feel free to re-open if you can reproduce it.

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