www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2982] New: Assertion failure in function if() clause

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

           Summary: Assertion failure in function if() clause
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: andrei metalanguage.com


This code:

auto max(Ts...)(Ts args)
if (Ts.length >= 2
        && is(typeof(Ts[0].init > Ts[1].init ? Ts[1].init : Ts[0].init)))
{
    static if (Ts.length == 2)
        return args[1] > args[0] ? args[1] : args[0];
    else
        return max(max(args[0], args[1]), args[2 .. $]);
}

void main() {
   assert(max(4, 5) == 5);
   assert(max(2.2, 4.5) == 4.5);
   assert(max("Little", "Big") == "Little");

   assert(max(4, 5.5) == 5.5);
   assert(max(5.5, 4) == 5.5);
}

is greeted with this error:

dmd: inline.c:1423: Expression* FuncDeclaration::doInline(InlineScanState*,
Expression*, Array*): Assertion `parameters->dim == arguments->dim' failed.
Aborted
dmd: inline.c:1423: Expression* FuncDeclaration::doInline(InlineScanState*,
Expression*, Array*): Assertion `parameters->dim == arguments->dim' failed.
Aborted

when compiled with "-unittest -O -release -inline", and with this error:

dmd: glue.c:939: virtual unsigned int Type::totym(): Assertion `0' failed.
Aborted

when compiled without flags.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 15 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2982






22:39:51 PDT ---
Reduces to:

auto max(Ts...)(Ts args)
{
        return 5;
}

void main() {
   assert(max(4, 5) == 5);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 15 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2982


Gide Nwawudu <gide nwawudu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com





*** Issue 2863 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: -------
May 16 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2982


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug yahoo.com.au





Please check if this is the same as 854 (which has an unapplied patch). This is
the single most commonly encountered ICE in DMD, it has at least six
duplicates.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 16 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2982


David Simcha <dsimcha yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |dsimcha yahoo.com
         Resolution|                            |DUPLICATE





---
Dup of 2251, which is closely related to and arguably a dup of 854.

*** This issue has been marked as a duplicate of issue 2251 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 16 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2982






02:56:37 PDT ---
Fixed dmd 2.031

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 09 2009