[Issue 1571] Segfault(class.c) const on function parameters not carried through to .di file

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Sep 10 14:21:20 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=1571


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|wrong-code                  |ice-on-invalid-code, patch
                 CC|                            |clugdbug at yahoo.com.au
            Summary|const on function           |Segfault(class.c) const on
                   |parameters not carried      |function parameters not
                   |through to .di file         |carried through to .di file


--- Comment #1 from Don <clugdbug at yahoo.com.au> 2009-09-10 14:21:20 PDT ---
This now segfaults. crashing ClassDeclaration::toCBuffer on members->dim when
members is null.

With the attached patch, as well as preventing the crash, the correct output is
produced.

Patch: class.c line 735 and 749. should ensure class has members,
before writing the members out!

+if(members){
    buf->writenl();
    buf->writeByte('{');
        buf->writenl();
    for (int i = 0; i < members->dim; i++)
    {
        Dsymbol *s = (Dsymbol *)members->data[i];

        buf->writestring("    ");

        s->toCBuffer(buf, hgs);
        }
        buf->writestring("}");
 +   }    else    buf->writestring(";");

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


More information about the Digitalmars-d-bugs mailing list