Catch attempts to create a static instance of a class.

It is actually an error to create a static instance of a class.
This commit is contained in:
Bill Currie 2012-12-18 20:01:36 +09:00
parent f7006f13e8
commit 45c753f639

View file

@ -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) {