From 758a273ddae7a412e01e2414b1fc14219c4e5a2f Mon Sep 17 00:00:00 2001 From: k-hara Date: Wed, 29 Jul 2015 19:33:26 +0900 Subject: [PATCH] fix Issue 13792 - Segfault with a pointer of opaque enum type --- src/toctype.c | 5 +++++ test/compilable/ice13792.d | 6 ++++++ 2 files changed, 11 insertions(+) create mode 100644 test/compilable/ice13792.d diff --git a/src/toctype.c b/src/toctype.c index 48e8e817d198..e7c0ad99ebf7 100644 --- a/src/toctype.c +++ b/src/toctype.c @@ -218,6 +218,11 @@ class ToCtypeVisitor : public Visitor assert(0); } } + else if (!t->sym->memtype) + { + // Bugzilla 13792 + t->ctype = Type_toCtype(Type::tvoid); + } else if (t->sym->memtype->toBasetype()->ty == Tint32) { t->ctype = type_enum(t->sym->toPrettyChars(true), Type_toCtype(t->sym->memtype)); diff --git a/test/compilable/ice13792.d b/test/compilable/ice13792.d new file mode 100644 index 000000000000..2dab1e7982c7 --- /dev/null +++ b/test/compilable/ice13792.d @@ -0,0 +1,6 @@ +enum E; + +void main() +{ + E* p; // ICE in glue layer +}