Thread overview
[Issue 3429] New: Core dump on passing template literal to member function.
Oct 21, 2009
David Simcha
Oct 21, 2009
Don
Oct 21, 2009
Don
Nov 01, 2009
Kosmonaut
Nov 06, 2009
Walter Bright
October 21, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3429

           Summary: Core dump on passing template literal to member
                    function.
           Product: D
           Version: 2.035
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: dsimcha@yahoo.com


--- Comment #0 from David Simcha <dsimcha@yahoo.com> 2009-10-20 18:22:13 PDT ---
struct Foo {
    void doStuff(alias fun)() {}
}

void main() {
    Foo foo;
    foo.doStuff!( (i) { return i; })();
}

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



--- Comment #1 from Don <clugdbug@yahoo.com.au> 2009-10-21 02:26:17 PDT ---
Looks very similar to bug 2325 (but 2325 is D1-only). Probably has the same root cause.

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


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

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


--- Comment #2 from Don <clugdbug@yahoo.com.au> 2009-10-21 03:24:08 PDT ---
This one is trivial.
PATCH: template.c, line 4139. d needs to be initialized BEFORE the goto,
because it is used in the error message.

        Declaration *d = NULL;
        TemplateDeclaration *td = sa->isTemplateDeclaration();
+        d = sa->isDeclaration();
        if (td && td->literal)
        {
        goto L2;
        }
-        d = sa->isDeclaration();
        if (d && !d->isDataseg() &&
#if DMDV2
        !(d->storage_class & STCmanifest) &&
#endif
        (!d->isFuncDeclaration() || d->isFuncDeclaration()->isNested()) &&
        !isTemplateMixin())
        {
         L2:


Actually, I'm not sure why this goto is even there. It could just be a clause in the 'if' statement!

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


Kosmonaut <Kosmonaut@tempinbox.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Kosmonaut@tempinbox.com


--- Comment #3 from Kosmonaut <Kosmonaut@tempinbox.com> 2009-10-31 21:39:12 PDT ---
Relevant SVN repository: http://www.dsource.org/projects/dmd/changeset/231

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


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> 2009-11-06 11:35:00 PST ---
Fixed dmd 2.036

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