Thread overview
[Issue 2982] New: Assertion failure in function if() clause
May 16, 2009
Walter Bright
May 16, 2009
Gide Nwawudu
[Issue 2982] ICE with variadic templates and auto return
May 16, 2009
Don
May 16, 2009
David Simcha
Jul 09, 2009
Walter Bright
May 15, 2009
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 16, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2982





--- Comment #1 from Walter Bright <bugzilla@digitalmars.com>  2009-05-15 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 16, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2982


Gide Nwawudu <gide@nwawudu.com> changed:

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




--- Comment #2 from Gide Nwawudu <gide@nwawudu.com>  2009-05-16 01:46:18 PDT ---
*** 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
http://d.puremagic.com/issues/show_bug.cgi?id=2982


Don <clugdbug@yahoo.com.au> changed:

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




--- Comment #3 from Don <clugdbug@yahoo.com.au>  2009-05-16 11:57:29 PDT ---
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
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




--- Comment #4 from David Simcha <dsimcha@yahoo.com>  2009-05-16 12:46:56 PDT ---
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: -------
July 09, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2982





--- Comment #5 from Walter Bright <bugzilla@digitalmars.com>  2009-07-09 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: -------