Bug 1571 – Segfault(class.c) const on function parameters not carried through to .di file

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2007-10-11T02:41:00Z
Last change time
2015-06-09T01:14:18Z
Keywords
ice-on-invalid-code, patch
Assigned to
nobody
Creator
bugzilla

Comments

Comment #0 by bugzilla — 2007-10-11T02:41:29Z
class C; void foo(const C c); and compiling with -H gives a .di file that is missing the const.
Comment #1 by clugdbug — 2009-09-10T14:21:20Z
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(";");
Comment #2 by bugzilla — 2009-10-06T02:12:56Z
Fixed dmd 1.048 and 2.033