[Issue 4529] Segfault(typinf.c) with writeln of functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 3 14:12:30 PDT 2010


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



--- Comment #2 from Don <clugdbug at yahoo.com.au> 2010-11-03 14:11:30 PDT ---
REDUCED TEST CASE:

int bug4529a() { return 0; }
int function() bug4529b;
auto ivorBomb1 = typeid(typeof(bug4529a));
auto ivorBomb2 = typeid(typeof(bug4529b));

Note that swapping the order of the two 

typinf.c, Type::getTypeInfo() line 152.
The crash is because vtinfo hasn't been initialized. And this happens because
we have a funny situation where vtinfo has been set up for the pointee (which
is a function), but not yet for the pointer (which is a pointer to a function). 

Possibly a more complete solution would be to disallow typeof(X) where X is a
function; if so, an assert(vtinfo) should still be added at this line.

------

                t->vtinfo->toObjFile(global.params.multiobj);
            }
        }
    }
+    if (!vtinfo)
+        vtinfo = t->vtinfo;
    Expression *e = new VarExp(0, t->vtinfo);
    e = e->addressOf(sc);
    e->type = t->vtinfo->type;          // do this so we don't get redundant
dereference
    return e;

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