Thread overview
[Issue 1460] New: Compiler crash on valid code
Aug 31, 2007
d-bugmail
Sep 01, 2007
d-bugmail
Sep 02, 2007
d-bugmail
Sep 29, 2007
d-bugmail
August 31, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1460

           Summary: Compiler crash on valid code
           Product: D
           Version: 1.020
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: samukha@voliacable.com


D 2.003 crashes as well.

struct S
{
    int x;
}

S foo(alias s)()
{
    const S ret = bar(s);

    return ret;
}

S bar(S s)
{
    return s;
}

S baz(int x)()
{
    const S s = {x};

    return foo!(s)();
}

const r = baz!(1)();


-- 

September 01, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1460





------- Comment #1 from bugzilla@digitalmars.com  2007-09-01 14:26 -------
I'll fix the crashing problem, but the resulting code still won't work. That's because the template arguments are evaluated before trying to match them up with a template. That means the const declaration of s is replaced with a struct literal S(1). Struct literals don't match aliases.


-- 

September 02, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1460





------- Comment #2 from samukha@voliacable.com  2007-09-02 06:13 -------
A regrettable limitation and somewhat inconsistent with cases like passing uninitialized constant to alias parameter (issue 1456)



-- 

September 29, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1460


bugzilla@digitalmars.com changed:

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




------- Comment #3 from bugzilla@digitalmars.com  2007-09-28 22:16 -------
Fixed dmd 1.021 and 2.004


--