Thread overview
[Issue 3044] New: Bus error compiling the following code
[Issue 3044] Segfault(template.c) instantiating struct tuple constructor with zero arguments.
Jun 03, 2009
Don
Jul 09, 2009
Walter Bright
June 01, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3044

           Summary: Bus error compiling the following code
           Product: D
           Version: 2.030
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: sean@invisibleduck.org


import std.typecons;

void fn(T)( T val )
{
    T* tmp = new T;
}

void main()
{
    fn( tuple(5) );
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 03, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3044


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |clugdbug@yahoo.com.au
           Platform|Other                       |x86
            Summary|Bus error compiling the     |Segfault(template.c)
                   |following code              |instantiating struct tuple
                   |                            |constructor with zero
                   |                            |arguments.
         OS/Version|Mac OS X                    |All




--- Comment #1 from Don <clugdbug@yahoo.com.au>  2009-06-02 17:12:40 PDT ---
Applies on all platforms. Segfaulting in template.c 854

Reduced test case shows it's caused by a tuple this() struct constructor.

struct Foo {
    this(U...)(U values)  { }
}

void main(){
  new Foo;
}

Segfaulting in template.c (854)
    nfargs = fargs->dim;        // number of function arguments

PATCH: template.c(854)
    if (!fargs) nfargs=0;
    else nfargs = fargs->dim;        // number of function arguments

-- 
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=3044


Walter Bright <bugzilla@digitalmars.com> changed:

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




--- Comment #2 from Walter Bright <bugzilla@digitalmars.com>  2009-07-09 02:51:20 PDT ---
Fixed dmd 1.046 and 2.031

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