From 45c753f6392236e26b1ece91068c8c9b424ff21e Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 18 Dec 2012 20:01:36 +0900 Subject: [PATCH] Catch attempts to create a static instance of a class. It is actually an error to create a static instance of a class. --- tools/qfcc/source/def.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/qfcc/source/def.c b/tools/qfcc/source/def.c index 300dbdce3..c5a66d762 100644 --- a/tools/qfcc/source/def.c +++ b/tools/qfcc/source/def.c @@ -46,6 +46,7 @@ #include "QF/va.h" #include "qfcc.h" +#include "class.h" #include "def.h" #include "defspace.h" #include "diagnostic.h" @@ -139,6 +140,12 @@ new_def (const char *name, type_t *type, defspace_t *space, if (!space && storage != sc_extern) internal_error (0, "non-external def with no storage space"); + if (is_class (type)) { + error (0, "statically allocated instance of class %s", + type->t.class->name); + return def; + } + if (storage != sc_extern) { int size = type_size (type); if (!size) {